pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Cailloux <olivier.caill...@gmail.com>
Subject Avoid losing data on PDF read / write
Date Sun, 30 Jul 2017 19:58:52 GMT
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 

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)?


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

View raw message