pdfcpu
pdfcpu copied to clipboard
maintaining bookmarks
pdfcpu supports annotations, properties and keywords but not bookmarks. it would be great if reading and inserting/deleting of bookmarks would be supported.
use case: A\ update bookmarks after some merge B\ use (technical) bookmarks on pdf creation to mark pages. use these marks to find pagenumbers. insert other PDFs. remove the these bookmarks after the merge
Hi there,
pdfcpu does allow you to create your own bookmark hierarchy for a PDF without bookmarks.
I need to know if you are a CLI or API user. Maintaining bookmarks via the CLI is kind of complicated. Right now you can create your own bookmark hierarchy from scatch via the API: See bookmarks_test.go
It's basic and there is room for improvement but I have been thinking about a convenient way which is not easy. Especially editing existing bookmarks.
BTW the pdfcpu merge facility does not preserve bookmarks right now.
I am a CLI user.
maybe bookmark import/export is then a better solution. as I understand it, a bookmark consists of title, level and pagenumber. export could produce something like a json file, one could do all the modifications and then import could completely override and replace the existing bookmark structure.
BTW: a -format json for list and info commands could be an awesome addition.
json-ifying all non trivial command input is one way - agreed - but I am still not sold on that. It might overwhelm the majority of the pdfcpu userbase and right now my focus is adoption.
I'd rather extend the API but editing bookmarks per se is not a trivial task. A bookmark's destination (which really is an outlineItem dict) may be any location on any page and may be using a zoom level .. and even more like the PDF spec will tell you.
BTW the pdfcpu merge facility does not preserve bookmarks right now.
@hhrutter: is this on the roadmap? Should I file a formal feature request? I would love to be able to maintain the bookmarks in my PDFs when merging them into one file.
Edit: ah, I see that you believe this to be a very challenging problem. Your comment on a related issue:
Merging documents with outlines/bookmarks is part of https://github.com/pdfcpu/pdfcpu/releases/tag/v0.4.2
Fixed => https://github.com/pdfcpu/pdfcpu/releases/tag/v0.5.0