PDF Library for develop a JAVA based PDF viewer application

Q: I want to develop a Java based PDF viewer with the following features. Is your PDF library capable of doing all that?

  • The PDF viewer must be able to create bookmarks, comments and highlighted text.

  • It must be possible to open a PDF on a specific location, ideally on the location of a bookmark/comment/highlighted text, but at least on a specific page.

  • ObjectIDs of annotations (bookmarks, comments, highlighted text) must be persistent. I know of one PDF reader (PDF XChange Viewer) that has no persistent ObjectIDs - it changes objectIDs of bookmarks each time the user makes changes on the PDF and saves it and that is not desired for my PDF Viewer.


A: You could use PDFNet SDK for JAVA (http://www.pdftron.com/pdfnet/downloads.html) to create bookmarks, comments, and to highlighted text.

As a starting point you may want to take a look at Bookmarks, Annotations, and PDFView samples (http://www.pdftron.com/pdfnet/samplecode.html)

You can open a PDF and jump to a specific location (e.g. PDFView.SetCurrentPage() etc) or execute a bookmark/annotation action using PDFView. ExecuteAction().

To highlight text programmatically you could use PDFView.Select(Rect or Highlights) etc.

PDFNet can also preserve object ID-s. For this to work you need to make sure that you not using e_linearized flag in doc.Save(). Linearization (i.e. fast web-view) may shuffle objects around.