purePDF, a complete actionscript PDF library

PurePDF is a complete library for creating PDF documents using actionscript 3 ( targeted for flash player 10 ).
The project is actually hosted on google code.

This is is a porting I’ve made of the famous java iText library ( version 4.2 ) by Bruno Lowagie into pure actionscript 3.0 (with some little modifications).
iText ( and purePDF ) has tons of features for create and manipulate pdf documents. A quick list of the features actually implemented into purepdf:

  • pdf viewers display options
  • alpha transparency, blend modes
  • layers
  • arabic RTL writing
  • support for pdf text rendering ( example )
  • tables ( nested tables, page split tables, table with images, etc…)
  • slide show ( page transitions )
  • annotations, comments, file annotations
  • patterns, shadings patterns (linear and gradient), spot colors, rgb color and cmyk color
  • linear and radial gradients with alpha ( example or example 2 )
  • forms (user input forms, textfields, combo box, list, checkbox)
  • paragraphs, phrases, chunks for text manipulation, chapters, lists…
  • images (jpeg, png, animated gif, tif, bitmapdata ) and image patterns
  • basic and advanced paths
  • afm, otf, pfm, ttc and ttf fonts (embedded and not embedded)
  • metadata, page header and footers
  • external, internal links
  • barcodes creation ( ean-ucc 13, ucc-12, ean-ucc-8, upc-e, pdf 417, ean supplements) ( example )
  • unicode, cjk fonts and text
  • file attachments
  • javascript ( example )
  • multi column text
  • Embedded movies ( example )
  • Vertical text ( see this example )
  • and many other features…

You can take a look at this PDF document (self generated using actionscript reflection) with the purePDF APIs.

Other actionscript libraries I’ve used for this project are: fzlib, as3corelib, ashashmap, alchemy, as3-commons.

You can both download the library from source code and compile it yourself ( see at the Installation guide ) or download the precompiled swc files from the project’s download section.

Moreover there are actually a lot of examples to explain all the library features and for a quick guide. You can find them listed and updated here. In General refers to the project wiki for all the updated examples/howtos and the project updates.

update: here you can find the updated online api documentation

  • Could PurePDF be used to generate Flash Paper? It would be really great if PDF libs like PurePDF and AlivePDF also generated Flash Paper using the same API. Then users could do print previews and print directly from Flash.

  • This is awesome. It’s really filling a gap. Thanks a *lot*.

  • Paul Coates

    Great job.
    Is the PDFStamper class implemented?
    I coulldn’t find it in the documentation.

  • Nader

    Actually, regarding generating to flash paper. Even cooler would be to use this open source viewer which is like flashpaper but better really;

  • This is a very necessary thing. Thank you!

  • Alex

    Great Alessandro !
    Is it also possible to submit forms and get back the filled values ?
    Thanks a lot

  • Alessandro, that’s amazing – thanks for your great work!
    At the purepdf project on Google Code I have found some Alchemy stuff. Why did you need Alchemy, because iText is based on Java, isn’t?
    Again, great work!

  • There’s nothing particular in alchemy, just a couple of utility scripts to emulate C union and a static vector declaration because in flash it would cause a stack overflow.
    Anyway, iText is in java, right, but many of the java methods are native C.

  • WoW! Thanks for this and the rest of your site. I use it over and over.
    Do you have any suggesting for rending an MXML component to a pdf? Right now I am using alivePDF which is essentially a png grab. It struggles with quality and makes a real mess of scrolled and paged results.

  • Hi, I have a need to render wysiwyg text entered into a flex AS3 application into PDFs with the text formatting matching exactly what the customer entered. I don’t need to render PDFs directly from the flex application. Our flex app writes details about the customer’s creation (page layouts, photos used, text used) + the text formatting into XML and sends it to back-end servers. It is then rendered downstream into high quality print-ready PDFs. My issue is guaranteeing formatting consistency between the flex app and the PDF.
    Currently we use the standard Adobe textarea controls in flex and iText. Can PurePDF help with this problem?

  • If you’re already using iText on your server for PDF generation purePDF doesn’t help you. purePDF is a porting of iText so the only benefit I can see in your situation is that you will be able to generate the pdf within the client swf instead of stressing the remote server. BTW, purePDF should work exactly like iText.
    Btw I don’t see the problem with formatting a flash textarea into pdf with the same formatting. Are you having problems with this task?

  • purePDF, a complete actionscript PDF library

    Alessandro, alittleb.it co-founder, has just released an incredible actionscript PDF library. Chek out  purePDF on our tech-blog. Great work Alessandro!!!

  • Social comments and analytics for this post

    This post was mentioned on Twitter by togishi: Cool: PurePDF, a complete #as3 PDF Library: http://bit.ly/9PPQTX

  • Alvisng

    how to create vertical Text for chinese

  • Nasrullo

    Hi Alessandro, Thank you for great job with PurePDF.
    I run into a strange issue with Thai. When a diacritics placed a top of another, they are positioned wrong. I am embedding MS sans Serif.
    Can you please have a look?
    This is thai text : ซื้อ

  • Benoit

    Hi Alexandro,
    Thank you too for your great job with PurePDF 😉
    I have a question regarding the way I can use embedded fonts with PurePDF. I’m working on a project using about 20 different languages, with different alphabets. I have to use custom embedded fonts for each alphabet but I don’t want to embed them in the source code because of the weight. If a user is french, I don’t want him to load the chinese font. My question is how to use dynamically loaded fonts with purePDf?
    Thank you!

  • jorge lima

    Hi Alexandro, can you answer my message that I sent to you in your G+ account? Very important. It’s about install purePDF and so on…