Hi,

In my project I am exporting bookmarks from a PDF to an XML file, and at 
another stage importing the bookmarks from the XML file into the PDF. In doing 
this I've noticed an issue with the index of the page returned by the 
PDPageDestination methods.

My situation is as follows:
I have a PDF with a bookmark on the second page. That bookmark is represented 
by a PDOutlineItem with a PDActionGoTo and a PDPageDestination.
Calling PDPageDestination.findPageNumber() on the bookmark's destination 
results in the integer 2. So far so good. I write to my XML file that the 
bookmark is on page 2.
When reading the XML, I create a new PDGoTo action with a PDPageDestination. 
This PDPageDestination receives an array with the integer 2 as the first 
element.
When I ask this new PDPageDestination for its pagenumber, using 
PDPageDestination.findPageNumber(), I receive 2. Since this is the same code I 
used to determine the bookmarked page in the first place, I would expect the 
bookmark to be made for the correct page at this point.

However, when I open the PDF in Adobe Acrobat Pro and inspect the bookmark, it 
says the page destination is 3! When going to the bookmark destination, I end 
up on the third page of the PDF.

Is this a bug in PDFBox? And does anyone have a solution on how to fix this?

Kind regards,


Johanneke Lamberink

Reply via email to