This page lists the frequently asked questions we have encountered on using our PDF library and contains links to code examples which you can use. If you have a question we do not answer here, please post on the support forums and we will answer.
You can get a full list of the PDF Specification supported here.
Our support section includes lots of very simple examples (most around 3 lines of code) to convert PDF to Image, extract text, perform text search, access form Data, get a page count, access PDF metadata, print a PDF, etc.
We have customers using it on both. Viewer, ViewerFX provide viewers, PdfDecoder provides Swing and non-Swing support and PdfDecoderServer can used on the server in headless mode or for non-GUI and non-printing functions.
//debugging code to create a log LogWriter.setupLogFile("v"); //echo to screen LogWriter.log_name = "/mnt/shared/log.txt"; //logfile
There is a public static variable PdfDecoder.version or PdfDecoderServer.version which you can access.
org/jpedal/examples/baseviewer/BaseViewer.java and org/jpedal/examples/baseviewer/BaseViewerFX.java are very simple java PDF viewers with minimal functionality.
We would recommend you look our fully featured Swing PDF viewer or JavaFX PDF viewer. They are totally configurable and include lots of functionality (Search/Print/multiple views/etc). You can easily switch between them as they share the same API.
Try this Java code (with the JPedal jar on your classpath).
Viewer viewer = new Viewer(rootContainer, null);
ViewerFX viewer = new ViewerFX(rootContainer, null);
Now the object has been set up correctly it can be added to your application like any other swing component.
Here is the simple Swing application I made, demonstrating how this can be done.
If you wish to remove some or all of the viewer user interface that is also possible by simply setting the preferences to display the desired components and passing in the path (on the file system or within the jar by adding “jar:” to the start of the path) to this file in the Viewer(Container display, String PreferencesPath) constructor.
org/jpedal/examples/printing/SilentPrint.java is a full code example (with additional features) to print a PDF file.
There is also a 5 step tutorial to add printing to your code on at how-to-print-pdf-files-in-java
The support section provides some simple APIs for fully automated PDF to image conversion.
There is a tutorial on highlighting-text-in-viewer