Here you will find some sample applications that create and manipulate PDFXML content. One of the strengths of PDFXML is the ability developers have to easily interface with the file format. Below we show two sample applications: one written in Java™ and one which uses Adobe® AIR™.*
Java Sample Application
The Java program that manipulates PDFXML documents is actually a series of different kinds of manipulations all combined into one command-line driven program for demonstration purposes. The program itself can perform the following manipulations on an existing PDFXML document:
- Add a grid to each page in the document
- Add buttons to each page in the document
- Add a stamp annotation to each page in the document
- Add a watermark to each page in the document
- Insert pages from one PDFXML file into a designated location in another PDFXML file
- Compute the complete set of files that comprise a PDFXML document, check that all those files are present in the PDFXML Zip package, and list any extra files that are in the package but not part of the document itself
- Add a form to a PDFXML document (such as adding an order form to a document representing a catalog)
The Java code uses Java’s built-in Java.Util.Zip library to manipulate the PDFXML package. XML is created or manipulated using Java’s built-in XML handling classes. All of the Java code for these functions is included in source form. Installation and build instructions are also included. You can use the sample PDFXML documents as sample documents for these applications, or create your own by using the PDFXML plug-in for Adobe Acrobat Professional (8.1 or 9).
* Sun, Sun Microsystems, the Sun Logo, Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
Adobe AIR Sample Application
The Mars Album Adobe AIR application demonstrates constructing a PDFXML file from a database. In the Album example, we don’t actually include the code to interface to a database; instead we use data the user enters into the Adobe AIR application. If you build and run the Album application, it requests some photos from files, allows you to enter captions, and then constructs a PDXML document that is a simple photo album with a contact sheet and the photos and captions.
The Mars Album code is written in ActionScript. A simple ZIP library is included to handle the interface with the PDFXML package format. The SVG and other XML content in this sample is constructed as strings in the ActionScript code and then written to files in the ZIP container. The source code download includes instructions on how to build and run the application.
Download the Mars Album Sample Application Source Code (ZIP, 45 KB)
Download the Mars Album Sample Application (AIR, 740 KB)