Mobileread
Get list of sections to add bookmarks?
#1  Shohreh 06-22-2022, 07:05 AM
Hello,

I'd like to add bookmarks to an existing PDF that has none.

Is there a way to parse a PDF and extract its structure into a text file, which I could then feed to cpdf?

Code
cpdf.exe -add-bookmarks bookmarks.txt input.pdf -o output.pdf
Thank you.

---
Edit: Since each kind of title (H1, H2, etc.) are formatted in a specific way, it might be possible to find all objects that match (font + size).

https://resources.infosecinstitute.com/topic/pdf-file-format-basic-structure/
Reply 

#2  willus 07-04-2022, 07:43 PM
Quote Shohreh
I'd like to add bookmarks to an existing PDF that has none.

Is there a way to parse a PDF and extract its structure into a text file, which I could then feed to cpdf?
Possibly you could extract the text layer and then parse through it looking for obvious beginnings of chapters or sections based on the text? Would depend on the PDF.
Reply 

#3  Shohreh 07-09-2022, 09:02 AM
Thanks for the tip.
Reply 

Today's Posts | Search this Thread | Login | Register