jPDFViewer Live Applets
Live applets samples to view PDF documents
Below are a few examples of applets to deploy jPDFViewer in a web application. If you’re not sure how you want to deploy jPDFViewer, contact us so we can point you to the appropriate sample.
- Basic PDF Viewer Applet – This is a fastest way to launch jPDFViewer in an applet using our webviewer jar package. When the applet starts, it loads a PDF document.
- Basic PDF Viewer Applet with All Optional Jars – This is the same as above but with all optional jars included in the class path so this applet can display PDF documents with digital signatures, CMYK content, JPEG2000 images as well as interactive forms with JavaScript. Read more about optional jars.
- PDF Viewer Applet with Hidden Buttons – The buttons on the toolbar of the viewer can be configured from the HTML that launches it. In this example, the viewer is displayed without the open and print buttons.
- PDF Viewer Applet with Javascript Interaction – jPDFViewer can interact with JavaScript to drive some of its interface. In this sample, we use JavaScript to hide and display buttons, load other documents and set the page.
- PDF Viewer Applet with Custom Opener – jPDFViewer can be set to use a custom “opener”, an external interface that jPDFViewer calls when the user presses the open button. This mechanism can be used to open PDF documents from somewhere other than the local file system, such as from a web server or a database.
- In this sample, jPDFViewer gets a list of files from a web server, shows these to the user and then opens the file directly from the web server when one is chosen. To see the results, press the open button on the toolbar.
- PDF Viewer Applet with CMYK Profiles – This applet includes the Adobe CMYK profile to convert CMYK colors to RGB in the exact same way that Adobe does.
Applet Deployment
To deploy the web viewer on your website, you will need the HTML page that launches the viewer applet (above) as well as the following two jar files.
- jPDFViewer.jar – The main jPDFViewer jar file (signed), that contains the PDF viewing component.
- webviewer.jar – The Java applet that contains the jPDFViewer component. The jar file contains the source code to the applet so that you can modify to meet your needs. It is signed.
These jars as well as any other jar included in the applet archive in the HTML page need to be signed with the same code signing certificate.
Applet Parameters
When launching an applet, the HTML code can pass parameters to the applet to set any options that the applet supports. The applet then takes this parameters and can implement the options. In the applet used in these samples, we have defined the following parameters:
- OpenURL – This parameter can be set to the URL of a PDF document to load when the applet is launched.
- OpenVisible – This parameter tells the applet whether to display the open button on the toolbar. Valid values are “true”, “false”, “1” and “0”.
- PrintVisible – This parameter tells the applet whether to display the print button on the toolbar. Valid values are “true”, “false”, “1” and “0”.
- ToolbarVisible – This parameter tells the applet whether to display the toolbar on the viewer. Valid values are “true”, “false”, “1” and “0”.
- Scale – This parameters tells the applet to set the initial scale. This is a percentage value with 100 being normal size.
- DocumentList – This parameter tells the applet to use a custom opener that will get its list of files from an XML file from the given URL. The XML file will contain a list of PDF files that should be shown to the user and can include sub-folders. You can look at a sample list here.
- DocumentList_Text – This parameter tells the applet to use a custom opener that will get its list of files from a text list from the given URL. The text list should be composed of two values for each line, separated by the tab character. The first value should be the name of the document, used to display to the user. The second value should be the URL to the PDF document, used when loading the document. You can look at a sample list here.
Please keep in mind that we have defined these parameters to illustrate the capabilities when deploying jPDFViewer in an applet. We provide the source code to this applet, so additional parameters and / or features can be added according to your needs.
We can also consult with you to implement additional features and parameters.