Search code examples
itextbookmarks

Access pdf bookmarks from another browser tab or window using iText


I am relatively new to itext. I am wondering if this is even possible. I have a web app that includes a display button and links to bookmarks on a pdf on a html page. On clicking on the display button, the pdf will be streamed to another tab using itext. Once it has been streamed to the other tab, is it possible to click on the link on the first tab and have it set the pdf to the bookmarked page in the other tab? Would the pdf have to be stream again with the bookmark set?

I hope this makes sense.

Thanks, Greg


Solution

  • You can certainly add bookmarks to a pdf document using iText.

    For more information about that, see http://developers.itextpdf.com/content/itext-7-building-blocks/chapter-6-creating-actions-destinations-and-bookmarks

    However displaying a pdf document is not related to iText at all. iText generates and manipulates pdfs, or even extracts information from pdfs. But rendering is something it doesn't do.

    If you're rendering a pdf from a browser, you might be using some browser specific functionality, or for instance pdf.js (a javascript library to display pdf documents).

    Whether or not you can link to a specific bookmark in a pdf depends entirely on whether or not the viewer allows you to open a pdf at a given bookmark.