JPDF Sample Code -- Readme

The sample_code directory contains several applications which make use of the JPDF to implement various printing functionality. These Sample Code Applications demonstrate a small subset of the capabilities of the JPDF. The JPDF Demo can be used to gain a fuller appreciation of these capabilities.

Each Sample Code Application is contained in a separate subdirectory of the sample_code directory. Each subdirectory contains a batch file suitable for executing the application in a Windows environment. You may need to modify these batch files to specify the path to the JRE on your workstation. The Java source-code files for these applications contain comments which provide an explanation of the JPDF API calls that are made.

The Sample Code Applications are briefly summarized in the following table.

Name/Component Description
PreviewOffscreenHtml  javax.swing.JEditorPane  Displays a Swing Editor Pane (JEditorPane) containing HTML in a Preview Dialog. The Page Setup and Print dialogs can be displayed from the Preview Dialog. This application demonstrates the ability to preview and print an off-screen text component.
PreviewOffscreenTable  javax.swing.JTable  Displays a Swing Table (JTable) in a Preview Dialog. The Page Setup and Print dialogs can be displayed from the Preview Dialog. This application demonstrates the ability to preview and print an off-screen table.
SetupPreviewPrintHtml  javax.swing.JEditorPane  Displays a window containing HTML in a Swing Editor Pane (JEditorPane), and three buttons:
  1. Page Setup - displays a Page Setup dialog which displays the attributes to be used to print the Editor Pane.
  2. Print Preview - displays a Preview dialog which previews the Editor Pane.
  3. Print - displays a Print dialog which allows the Editor Pane to be printed.
This application demonstrates how to integrate JPDF capabilities into a Swing application.
SetupPreviewPrintTable  javax.swing.JTable  Displays a window containing a Swing Table (JTable), and three buttons:
  1. Page Setup - displays a Page Setup dialog which displays the attributes to be used to print the table.
  2. Print Preview - displays a Preview dialog which previews the table.
  3. Print - displays a Print dialog which allows the table to be printed.
This application demonstrates how to integrate JPDF capabilities into a Swing application.
SetupPreviewPrintTree  javax.swing.JTree  Displays a window containing a Swing Tree (JTree), and three buttons:
  1. Page Setup - displays a Page Setup dialog which displays the attributes to be used to print the tree.
  2. Print Preview - displays a Preview dialog which previews the tree.
  3. Print - displays a Print dialog which allows the tree to be printed.
This application demonstrates how to integrate JPDF capabilities into a Swing application.
SetupPreviewPrintStylepad  javax.swing.JEditorPane 
Adds preview/print capabilities to the Stylepad Demo application. Stylepad is one of the Demo applications included with the Java SDK. New items are added to the File Menu to allow the user to access the preview/print capabilities.

(NOTE: JRE version 1.5 must be used to run this Sample Application -- version 1.4 will not work. This is due to the fact that included Stylepad.jar file is compiled for JRE 1.5. It is not due to any JPDF limitation.)

A purchase of the JPDF includes many additional Sample Code Applications which demonstrate the more advanced capabilities of the software.