The API allows you to add additional display content to the JPedal Swing PDF viewer (for example your own Annotations or a watermark). You can also have a different set of objects for display and printing.
Adding objects to a displayed page
The method org.jpedal.PdfDecoder.drawAdditionalObjectsOverPage(...) makes this possible. This function is best explained with example code, so here is a draw example for Swing Viewer. This is a good starting point for experimenting with this feature. If you wish to print across a page range, this needs to be setup on a document basis. For this reason, PDF printing is handled separately. The method org.jpedal.PdfDecoder.printAdditionalObjectsOverPage(...) makes this possible. Here is a documented print example.
Removing objects from a displayed page
The method org.jpedal.PdfDecoder.flushAdditionalObjectsOnPage() removes Swing objects from the display. Here is a documented code example.
You can also add custom objects in Swing which implement the interface org.jpedal.external.JPedalCustomDrawObject to give you total control over drawing. It also includes methods to control visibility and a separate method for printing. An inner class example is here.
Note: In certain cases a PDF file can have a clip set on it, in which case some custom objects may not be visible. We suggest setting the clip to null before any additional objects are drawn.
Important note on PDF printing
You can either create separate objects for each page or create a global set for all pages. This is done by using printAdditionalObjectsOverAllPages() method. See an example here.