Viewing PDF in Adobe AIR on Android etc

Q:

I ran across PDFTron SDKs and was wondering if you have tried using it within a AIR ANE? AIR apps for mobile don’t really have a good solution for viewing pdfs, especially on Android, so I was wondering if your solution could do this.

A:

For viewing PDFs, there are couple of options:

a) native route via PDFNet Mobile SDKs (http://www.pdftron.com/pdfnet/mobile)
b) browser based viewing (HTML+JS / Flash / Silverlight ) via WebViewer (http://www.pdftron.com/pdfnet/webviewer)

With option a) you could use native SDK either directly as part of native Android/iOS/WinRT/WP8/… app our you can try to access the native library via Native Extensions for Air (ANE). The last time we tried Native Extensions for Air we found that interop suffered from some limitations (e.g. related to exception handling etc.), but these may have beed addressed in recent updates from Adobe.

The second option is WebViewer (you could use either Flash or HTML/JS clinet). This solution might be simpler on the application side, however it will not load a PDF file directly. Instead you need to first convert the PDF to a XOD file (which is a web optimized XPS file). There are three ways to do this, see the link below for details. Note, that though it’s called WebViewer, the Flash version is capable of loading local XOD files, and it can load while the PDF is being converted to XOD. For more info please see: http://www.pdftron.com/pdfnet/webviewer/download.html, http://www.pdftron.com/pdfnet/webviewer/demo/samples.html, http://www.pdftron.com/pdfnet/webviewer/demo/documentation.html.

Please keep in mind that if you use HTML5 WebViewer you would not necessarily need to use Flash at all (althoug you could if you really want to stick with Flash/AIR). Instead you can just write the app in JS+HTML. You can either write a browser based app or you can create minimal native (e.g. android, ios, …) app with embedded browser control (i.e. WebView), which loads WebViewer. For a concrete example, please take a look at Android sample project ( see ‘WebViewer\samples\android’) that comes along the latest WebViewer Beta package (https://groups.google.com/d/msg/pdfnet-webviewer/4XkCgdLi4Z8/4Eh5EJEAfsMJ ).

Note: Both HTML5 and Flash viewers come with local part retrievers that will allow you read local files (WebViewer\samples\android\src\com\pdftron\webviewer\LocalFileContentProvider.java) in online or offline mode.