I recommend a deep look at the PDF specification. Sadly there are so many features everywhere. An outline may have Dest or A, but also more elements. And the actions are also complex... You can get the raw dictionary with getCOSObject().

Tilman

Am 30.07.2017 um 21:58 schrieb Olivier Cailloux:
I built a simple GUI for writing outlines to PDF files. The GUI only permits to edit simple outlines: trees of bookmarks that each point to a page in the document. (So, for example, other kind of actions triggered by bookmarks is not supported.)

Now I would like to know, when I read a PDF file, if the outline it contains has more information than I am able to store and display and write back. (If so, I’d like to at least warn the user that overwriting her file with my software after editing the outline might cause information loss.) In particular, I’d like to be able to read back PDF files whose outline have been written with my very software, as this is safe.

Thus, my question is: can I ensure that a given PDDocumentOutline contains only a simple outline (as defined above), and no other information?

Currently, given a PDDocument current and PDDocumentOutline pdOutline, I get an Iterable<PDOutlineItem> children = pdOutline.children(), then for each PDOutlineItem child I use child.findDestinationPage(current) (where current is the document I am processing). If findDestinationPage returns null I know I am facing a non-simple outline. This goes on recursively.

Assuming this procedure never returns null on any findDestinationPage call, can I deduce that the document outline is simple (as defined above)?

Olivier




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to