AlivePDF is an open source library for generating PDFs in
ActionScript on the client side. It’s offered under the MIT license at
http://alivepdf.org; download AlivePDF.swc and link it to your Flex Builder
project. One of the classes included in AlivePDF.swc is called
Unless you are developing an AIR application or deploying it for Flash Player 10 (see the next note), even client-generated PDF content has to be sent to a server that will just bounce it back (see Example 11-20) to have the web browser open the Acrobat Reader plug-in.
The process of generating PDFs in AlivePDF starts with
instantiation of the
savePdf() to turn these pages into a
ByteArray and save them to the PDF
file on your filesystem if you use Adobe AIR. If this is a web
application written in Flex, the same
savePdf() function sends the
ByteArray to the server with the deployed
script create.php (supplied by alivepdf.org), which will return this
array of bytes to your web browser as a PDF document.
Starting from Flash Player 10, the
FileReference class allows you to save files
locally. Its function
save() opens the pop-up window, allowing the user to specify the filename for saving the data. In our example, this eliminates the need for a round trip to the server ...