You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't have the prettiest solution, but it worked for me.
I added the TOC with page numbers like this:
You have to generate the pdf with the TOC (without page numbers)
You read out the metadata of the pdf
Now you can filter out the headings by the font size and you also get the page number (where the heading is placed)
You store each (heading/page number) pair in a Map
Now you have to generate the pdf once again in order to add the page numbers to the table of contents
You have your finished pdf
Note: if your pdf contains a long heading you have to take that into account when adding the page numbers to the TOC. You may have to merge the map entries so that the headings match.
I have no clean idea.
ref: https://medium.com/@pofider/generate-pdf-with-toc-using-chrome-c3b44f924ff9
The text was updated successfully, but these errors were encountered: