I' facing a problem with exporting bookmarks from PDF files, and I tied to use pdftk for that:
pkftk.exe input.pdf dump_data output results.txt
However, pdftk does not export the exact page numbers where the bookmarks were set, but rather the page numbers of the view. If, when setting a bookmark in Foxit Reader, I not only have the page in view where I set the bookmark but also see the lower part of the previous page, then the page number of the previous page is exported. The bookmark works correctly interactively, and both pages are displayed in the view with the exact scroll position. However, I need the page number of the page where the bookmark was actually set. This information is certainly stored in the pdf, so there should be a way to export it. How can I achieve this? Probably pdftk is not the right tool for this and there might be better approaches using scripts or other programs (preferably free and command line for usage in scripts).
Update: now I tried jpdfbookmark:
jpdfbookmarks_cli -d inputFile.pdf >results.txt
Results.txt contains one line per bookmark, like the following 2:
TESTA_pg2inViewAndMarkedOnPg2/2,Black,notBold,notItalic,open,FitWidth,813 TESTB_pg2inViewAndMargedOnPg3/2,Black,notBold,notItalic,open,FitWidth,813
After the first / is the page number. If the last value is "1", then only that page has been in view when setting the bookmark. But if the value is <>1 than it seems to denote a scroll offset from the beginning of the denoted page. That takes me one step further but isn't the final solution. The two bookmarks shown here are both set on the same view, without scrolling. For the first bookmark, something on page 2 was marked, and for the second, something on page 3. Hence, the bookmark page number is identical, as is the offset. So with these values I can't decide on which page a bookmark was set.