Accessibility

Table of Contents

Building a portable RIA with Flex and PDF

Try it yourself, first

So you can see how this works. I've put together a demo illustrating the portable RIA concept. You will need Adobe Reader 9 in order for this to work. First load the Flex Dashboard application in your browser. Then in the application click the "Create PDF" button. Now you should be looking at the same data inside of a PDF! You can even save the PDF locally and view it when disconnected. You can also refresh the data from the server within the PDF (see Figure 1) or within the browser.

A screen shot of the sample application in Adobe Reader

Figure 1. A screen shot of the sample application in Adobe Reader

On the server, a back-end PDF generation service has access to a template PDF containing the Flex application without any data. When the user asks for a PDF the data is inserted into the PDF template and delivered to the user. Optionally the PDF could be secured with PDF policy protection before being sent to the user. You can also create these PDFs in a nightly batch process.

Getting started

You need several pieces to build a portable RIA. First, you need a Flex application that the user will interact with in their browser and inside a PDF. Second, you need some place for the Flex application to get its data. Third, you need a PDF template and a server that can insert the application data into it when the user requests a PDF. I used the following steps to build these pieces:

  1. Create the back-end data source for the application
  2. Create the basic Flex front-end application
  3. Create a back-end PDF generation service
  4. Create a PDF with form fields that will be used to store the data
  5. Modify the Flex application to read data from the PDF
  6. Add a way for the user to generate a PDF from the Flex application
  7. Merge the final Flex application into the PDF template

To complete this tutorial you'll need a Java web app server (such as Tomcat, JBoss, WebLogic, WebSphere, or similar), LiveCycle Data Services 2.6, Flex Builder 3 (installed as a plugin for Eclipse), Acrobat 9 to create the PDF, and optionally Adobe LiveCycle Designer 8.2.