I'm using api2pdf to merge many different file types (docx, xlsx, jpg, png, pdf) to a single pdf. Now I want to also create a table of contents, but for that to work I have to first add bookmarks to the first page of each input file.
The challenge is that xlsx, docx and pdf input files can be more than one page long, so to calculate where to put the bookmarks I need to know the length of each input document. Any suggestions on how I could do this?