Lab-6808: Working with PDF and Java

Expected Duration: 120 minutes
Contacts: Duane Nickull

Last Updated: April 29, 2009

This course is designed to introduce Java ™ developers to the basic concepts involved in working with the International Standards Organization (ISO) Portable Document Format (PDF) as defined in the ISO specification. This course will take developers through simple exercises first by writing code in Java to manipulate PDF in various ways and then how to invoke services in Adobe LiveCycle ES using the Java Client libraries.

Presentation files (PDF Format) can be found here.

Abstract:

The PDF ISO standard has experienced a large growth in adoption by government and enterprises. Many of these have requirements to round trip information between a J2EE environment and PDF forms or static documents. This hands on labs will be about 25% presentation and 75% coding and working with the PDF libraries.

The core Java PDF libraries will be explored included how to create PDF documents, how to read and write to and from file systems, how to get PDF attachments, how to access metadata libraries and more.

The lab environment will be set up with JDK, JBoss and Adobe LiveCycle ES. Developers wishing to continue with the development will be able to take the environment home.

This course has been put together in hopes to provide developers a boot camp to learn all the basics concepts for working with ISO PDF documents from a Java Programming language environment. Although we tried hard to cover everything, it was simply not possible in such a short time. Our overall goal is to provide you with an introduction to and various pointers so you can make your own decision if you want to pursue this exciting new application development technology in the future. If you do, we will be providing additional references where you can continue learning and become part of the larger community after this course is over.

IMPORTANT: There is a high probability we will not get through the entire course during the time allotted at JavaOne 2009. This is by design. The course reflects a best case scenario whereby everyone covers the materials quickly. We felt it better to have extra rather than not enough content. If we do not get through the entire course, you can take the remaining labs by yourself as this instructional handout has sufficient notes to complete everything

This course is written in such a manner that you should be able to take this alone as a self paced tutorial, although during the delivery of the course, we will be there to lead you through it and help in the event you encounter any problems.

We hope you enjoy this course as much as we enjoyed putting it together. Remember – we are here for you. Don’t hesitate to ask any questions during the event and afterwards.

Copyright:

Other than product images, this work is licensed under a Creative Commons Attribution 3.0 Unported License. You may redistribute and quote from parts of this article however attribution is expected.  There is no need to seek explicit permission to reuse part of this paper or quote from it.  The software and various libraries used in this course each have their own licenses.  Readers must consult the owners of various properties to determine under what conditions they may use or deploy the software and/or various libraries. Note that you may NOT use or distribute the XPAAJ.jar library without express written permission of Adobe Systems. It is used for this lab only for illustrative purposes.


Prerequisites

 

This hands-on lab assumes you have some basic knowledge of, or programming experience in, the following technologies:

  • Java™ language programming
  • Web Services knowledge
  • Eclipse 3.4 (tested - other Java IDE's may work)
  • Java JDK 1.5.0 or later version of 1.5 (Not 1.6)
  • Adobe Acrobat or Reader, version 9 or above.
  • The varioius *jar files and starter files contained in the <lab_root> directory.

System Requirements

 
  • Supported OS's: Windows, Mac OS X 10.4+ (tested), Linux and Solaris should work but are not fully tested.
  • Java JDK 1.5 (not tested with 1.6)
  • Memory requirement: 2000MB
  • Disk space requirement: < 1 GB

Software Needed For This Lab

 

Please install the following set of software. If you have any questions on installation, please feel free to send questions to dnickull@adobe.com.

Preparation:

1. You will need to download and install a PDF reading software. Adobe Acrobat Pro is highly recommended. A free trial version is available at http://www.adobe.com/products/acrobatpro/tryout.html. You may also try Adobe Reader, downloadable at http://get.adobe.com/reader/

2. Download and install Java JDK 1.5.0_16. (NOTE: it is possible that build 16 will be superceded by another build. Subsequent builds of JDK 1.5.0 should work). It is available from http://java.sun.com/javase/downloads/index_jdk5.jsp. Follow the instructions for your particular operating system as detailed in the instructions and set both your PATH and JAVA_HOME environmental variables. When done properly, you should be able to type in "java -version" and "javac" in a command window (PC) or terminal prompt (Unix, Linux, Mac OSX) and see the following:

If you do not have your PATH and JAVA_HOME set properly, see the documentation here.

3. Download and install Eclipse EDE for Java EE Developers (3.4). Follow the instructions for your particular operating system.

4. Set up a workspace for Eclipse. This lab was written and tested with a "workspace" directory placed under the <root_Eclipse_folder> used as the workspace. For example, on Windows, if you installed Eclipse at c:\eclipse, you can make a directory for your workspace at c:\eclipse\workspace

5. Copy all the contents of the <lab_root>/PutUnderEclipseWorkSpace/ folder directly into your workspace folder. There should be four folders there as shown below.


5. When you open up Eclipse, you should be able to see (import) the folders referenced above, although there is no need to import the docs folder.

Alternative Configuration:

NOTE: THis is not used in this lab but is in case you wish to install Adobe LiveCycle ES on your own machine and access it at http://localhost.

Use this to have a self contained lab with all software on one laptop. To do this, you need to download and install Adobe LiveCycle ES 8.2.1 on your laptop (Windows only). Follow the link below and follow all instructions for getting this installed.

    Adobe LiveCycle ES which includes the following components (by installing the Adobe LiveCycle ES with developer license, you will also install the components below). NOTE: In any event, if you are setting up the lab by yourself, you will need to install this in order to gain access to the *.jar files you need to run the labs.

Follow the instructions from Adobe Systems for installing and configuring Adobe LiveCycle ES 8.2.1.


Notations Used in This Documentation

 
  • <lab_root> - directory into which lab zip file is unzipped

    • This document uses <lab_root> to denote the directory under which you have unzipped the lab zip file of this hands-on lab. The name of the lab zip file of this hands-on lab is 6808_javapdf.zip.

    • The <lab_root> folder below would be the folder javapdf

  • Your directory structure is as follows:
  • <lab_root>/ - this is the folder with these HTML pages and related assets. If you are reading this page, it is at<lab_root>/intro.html
  • <lab_root>/TeacherAssets/ - this folder contains the PPT slide deck, a teachers guide to teach this course and other assets. The teachers guide will be complete based on the HTML material represented here.
  • <lab_root>/APIDocs - Java API docs and other supplemental materials for the libraries used.
  • <lab_root>/PutUnderWorkspace - this folder contains all the Java libraries, source code and PDF, XDP, PS and other assets needed to work with this course. This folder contains sub directories which should be placed under your workspace in Eclipse. Under this directory, there are four sub-directories:



  • <lab_root>/PutUnderWorkspace/JavaOne2009 - Contains the STARTER exercises that attendees will use for exercises.
  • <lab_root>/PutUnderWorkspace/JavaOne2009_libs - Contains the libs sub-directory with the necessary JAR files required by all the exercises.
  • <lab_root>/PutUnderWorkspace/JavaOne2009Solutions - Contains the SOLUTIONS to all Exercises.
  • <lab_root>/PutUnderWorkspace/JavaOne2009-docs - Contains the documents necessary for processing during the exercises such as PDF, XDP, PostScript and other files.

Lab Exercises

 

Additional Resources

 

See Summary

 


Where To Go For Help

 
  • You can send technical questions via email to the authors of this Hands-on lab (and experts on the subject) or you can send your questions to the public users alias:
  • For general questions and feedback on JavaOne Hands-On Labs, please use the JavaOne_HOL_Forum
 

Back to top
To exercises

Update Your Java Runtime Environment