INCLUDE_DATA

Creating PDF documents with Adobe Flex on client side

Many flex developers complain about Adobe Flex 3 limitations. One of the most important missing features is ability to create PDF documents on flex client without using server side technologies like Adobe LiveCycle.

There is an open source PDF library implementation called AlivePDF written in ActionScript 3.0 but it is still very young and it does not cover all PDF features like encryption, permission, annotations, compression etc.

In many our projects we have often used an open source library LibHaru. This library is very extensive and it covers almost all features of professional PDF. Porting whole libHaru library from C to ActionScript it would requires a lot of effort and probably it will never be as fast as library written native C. I have discussed with our new colleague Piotr Chruscielewski the ways how we are going to create a new pdf library which would be able do this same functions like in original libHaru. He agreed to try to port libHaru pdf library to ActionScript. Fortunately we have found very simple way to do it. There is a Adobe Alchemy project which allows to compile code written in C/C++ language as swc library and allow call C functions directly from Action Script. Then Piotr has managed to build libHaru pdf library as normal swc library and he exposed its almost all functions to ActionScript language.

Although compiling and building from scratch libHary library in Alchemy is not so easy, the result at the end is very promising. Before you start compiling libHary you need to compile zlib compression library and libpng library. Also small adjustments to original source code are needed. Anyway, finally we able to create PDF documents on flex client side and create very complicated pdf documents. Whole code together with ActionScript is working perfectly and it is incredible fast and easy to use. You can also use this same library together with Adobe AIR.

Below you can find some tests. Right click to see whole sources.

Next Page →