Beyond Acrobat: Converting PDF to Flash using the Datalogics PDF Java Toolkit

Beyond Acrobat: Converting PDF to Flash using the Datalogics PDF Java Toolkit

Sample of the Week:

To close out the Beyond Acrobat series of samples I’m going to expose you to an odd little utility class in the Datalogics PDF Java Toolkit, the PDFToSWFConverter. I know.. I know… given the state of the Flash ecosystem these days, there are probably a million reasons why you wouldn’t want to convert a PDF to Flash but… again… given the state of the Flash ecosystem, there are probably at least as many reasons why you would. While it’s really, really cool that the conversion works so well, I’m not even going to try to suggest that it’s a good idea to do so… even though it’s really, really cool.

Instead, I’m using the existence of this class to discuss the Datalogics PDF Java Toolkit’s pedigree. Like most of the other APIs available through Datalogics, the PDF Java Toolkit was developed by Adobe. “Gibson” was the internal name of the Java Library that Adobe developed and is at the core of the Adobe LiveCycle Suite of products. While LiveCycles is best known for it’s form processing and workflow features, it also can assemble PDF files, be used for digitally signing files, perform redaction, work with 3D PDF, manage annotations, and apparently… convert PDF files to SWF. These functions all rely on the Gibson Library to do the actual work.

Because customers demanded interoperability between the PDF handled by LiveCycle on the server and their desktop installations of Acrobat, the Gibson Library needed to precisely mimic what Acrobat did… except on a server… so there’s an attention to detail and adherence to the PDF specification available via the Gibson Library that is, frankly, not present in other Java APIs. Adobe couldn’t afford to have their server tools corrupt the PDF files that customers created with Acrobat… it just wouldn’t look good… and enterprise IT departments wouldn’t stand for it.

Fast forward a few years and now Datalogics is able to offer the Gibson Library under the name Datalogics PDF Java Toolkit. Just like the Adobe PDF Library, the Datalogics PDF Java Toolkit allows ISVs to integrate real Adobe PDF technology into their own applications, virtually guaranteeing interoperability with the most popular PDF tools available on the market. Datalogics is able to offer ISVs the exact same tools that Adobe uses to develop their own applications.

The Gist below demonstrates how to convert each page of a PDF file to a separate SWF file and append the page number to the document name. Once you’ve got your SWF, you can incorporate it into any other Flash application and create one of those animated page flippers, package it in applications for iOS or just about anything else that Flash can do.

Leave a Reply

Your email address will not be published. Required fields are marked *