• jPDFNotes

    jPDFNotes

    jPDFNotes

    Bean to embed in your Java applications and applets to annotate PDF documents and fill interactive PDF forms.

    TRY LIVE DEMO

jPDFNotes Source Code Samples

Following are a number of Java samples that use jPDFNotes:

jPDFNotes in a standalone frame

SimpleFrame.java – A simple program that embeds jPDFNotes into a JFrame.


jPDFNotes in an Applet – jPDFNotes can be run inside a browser as an applet. The following sample code provides a simple HTML page that contains an applet that in turn contains jPDFNotes.

PDFNotesAppletJava – A Java applet that incorporates jPDFNotes. The applet takes a number of parameters from the HTML to load a document on initialization and to turn toolbar buttons on or off.

To run the applet on your server, you will need the following files:

pdfnotes.html – A simple HTML page that launches the applet.
jPDFNotes.jar – The jar file containing the jPDFNotes component classes.
notessamples.jar – The jar file containing the jPDFNotes samples.


jPDFNotes with custom annotation tools – jPDFNotes provides the API to let the host application create custom annotations and add them as tools in the toolbar or drop down menus. This sample does a number of customizations: It adds three buttons to the toolbars that create custom annotations, it adds a custom rubber stamp to the stamp drop down menu, and it sets the color of free text annotations to be always red.

SimpleFrame.java – A simple program that shows a Window with the jPDFNotes componennt inside. The program adds the custom buttons to the toolbar as well as the menu entry to the rubber stamp drop down menu.

MyNotesBean.java – A class that extends PDFNotesBean to override the startEdit() method. In the implementation of the method, if the annotation is a free text annotation, the color is set to red.


jPDFNotes with a custom saver – jPDFNotes allows the host application or applet to define a custom “saver”. This is useful when the PDF files should be saved back to a server instead of the local file system.

The following sample illustrates how to register a custom saver with jPDFNotes and implements saving back to a web server, using a multipart file upload POST message.

AppletWithUpload.java – A Java applet that incorporates jPDFNotes and also implements IPDFSaver, the interface necessary to register a custom saver. The IPDFSaver interface requires a save method that will be called when the user presses the saver button. The implementation of this method sends the PDF content to a web server using a multipart form POST with a file upload entry.

FileUploadPOST.java – This class implements the POST message to send the file contents back to the server.

CookieJar.java – Implements a cookie container to interact with the web server.

UploadStream.java– This stream passes the data through to the HTTP connection and calculates an MD5 digest for the content, to be appended to the multipart message.

ByteCounterSream.java – This stream is used to determine the length of the PDF content when creating the POST message.

On the server, we provide sample pages to receive the PDF content in a few technologies:

upload.php – A PHP script to receive the PDF file.

UploadServlet.java – A Java servlet to receive the file. This servlet uses the Apache Commons I/O and FileUpoad packages to parse the multipart message. These jar files can be downloaded free of charge from the Apache website.

upload.asp and uploadlib.asp – Classic ASP script that can receive the PDF content.

upload.aspx – ASP.NET script to receive the PDF content.

The HTML file to launch the applet and the JAR files that are referenced by the applet are:

pdfnotesupl.html – A simple HTML page that launches the applet.
jPDFNotes.jar – The jar file containing the jPDFNotes classes.
notessamples.jar – The jar file containing the jPDFNotes samples


jPDFNotes in Oracle Forms – Sample code to integrate our PDF notes taking component and a PDF form filler in Oracle Forms.