More about AlivePDF

I would like to show you whats'up with AlivePDF :)

As I told you the other day, I added a full drawing API into AlivePDF, now we got a cool API that works exactly as the Flash player drawing API.

Text support and image embedding has been added.

Let's say you want to create a PDF with a specific DisplayMode, one page, and one rectangle filled and flash.display.CapsStyle and flash.display.JointStyle strokes, you could do :

// we create an empty pdf, default user unit is in mm and A4
var myPDFEncoder:PDFEncoder = new PDFEncoder( Orientation.PORTRAIT, Unit.MM, Size.A4 );
// PDF will open with a specific DisplayMode and specific Layout
myPDFEncoder.setDisplayMode (Display.FULL_PAGE, Layout.SINGLE_PAGE);
// we add a page
myPDFEncoder.addPage();
// we choose the stroke style
myPDFEncoder.lineStyle ( 1, 1, null, CapsStyle.ROUND, JointStyle.MITER);
// next drawing call will be filled, you can specify RGB or CJMK colors
myPDFEncoder.beginFill ( 200, 89, 90 );
// we choose the stroke color
myPDFEncoder.lineColor ( 98, 255, 90 );
// we draw a rectangle
myPDFEncoder.drawRect ( new Rectangle ( 10, 26, 50, 25 ) );
// we choose a font
myPDFEncoder.setFont('helvetica', 12);
// we set text style
myPDFEncoder.textStyle (0x0);
// then we add some text, will specific location
myPDFEncoder.addText ('A rectangle with CapsStyle.ROUND and JointStyle.MITER', 70, 45);
//Then we can draw a circle in CMJK, with a dashed pattern stroke :
myPDFEncoder.lineStyle ( 1, 1, new DashedLine ([0, 2, 6]), CapsStyle.NONE, JointStyle.ROUND);
myPDFEncoder.beginFill ( 50, 80, 50, 30 );
myPDFEncoder.drawCircle( 30, 230, 20 );
//You can draw a rounded rectangle, or an ellipse :
myPDFEncoder.drawEllipse( 45, 275, 40, 15 );
myPDFEncoder.drawRoundedRect( 10, 60, 50, 40, 9);
//Now let's add some cubic curves and a polygone :
myPDFEncoder.lineStyle ( 1, 1, new DashedLine ([0, 6, 8]), CapsStyle.NONE, JointStyle.ROUND);
myPDFEncoder.moveTo ( 10, 200 );
myPDFEncoder.curveTo ( 120, 210, 196, 280, 139, 195 );
myPDFEncoder.curveTo ( 190, 110, 206, 190, 179, 205 );
myPDFEncoder.end();
myPDFEncoder.drawPolygone ( [50,95,150,115,100,20] );

If you want to embed any image, you can pass a valid image bytearray or any flash.display.DisplayObject, AlivePDF will capture it, and encode it to your favorite format (PNG, JPG) with a specific compression value for JPG :

myPDFEncoder.addImage (myBitmap, null , true, ImageFormat.JPG, 100, 0, 0, 0, 0);

Online Demo :

A Flash animation should have appeared here, but it seems that your browser has an older version of the Flash Player or it is not installed at all. Please, install the last release of the Flash Player now, then reload this page.

Comments (19)

  1. plugisto wrote:

    this is absolutely great!
    i wonder why adobe hasn’t come up with support between flash and pdf.

    keep going!
    plugisto

    Thursday, July 26, 2007 at 9:25 am #
  2. Cay wrote:

    Awesome work, this is just great!
    Is line (or fills) transparency working? How does it behave? Is there any way to test the library a bit? ^^ I’m really interested :)

    Thursday, July 26, 2007 at 9:31 am #
  3. Thibault Imbert wrote:

    Hi Cay,

    Thanks for your comment.

    Transparency is also supported, just like you would do with the flash player drawing API in the lineStyle method (0 to 1).

    You will be able to test it very soon ! :)

    Friday, July 27, 2007 at 1:53 am #
  4. Jules wrote:

    Hi Thibault,

    This is absolutely great! I would really like to generate PDFs from my little AIR app. Any plan for licensing (I hope not too expensive!)? When can I start using it??? :)

    Cheers

    Friday, July 27, 2007 at 2:00 am #
  5. Thibault Imbert wrote:

    Hi Jules,

    I am happy you like it, AlivePDF is perfect for AIR as you can directly save the PDF on the hard disk.

    AlivePDF will be totaly free, and you will be able to use it very soon, but I can’t give any exact dates for the moment.

    cheers ;)

    Friday, July 27, 2007 at 2:09 am #
  6. theklue wrote:

    This is awesome! Congrats Thibault, I think you’ve created an incredible useful library…
    Can’t wait to play a little with it… :)

    cheers,

    theklue

    Friday, July 27, 2007 at 2:15 pm #
  7. .: M :. wrote:

    Seems to me you’re about to release an awesome tool. Congrats on that!

    Just curious: are you planning to implement the opposite – meaning allow the import of pdfs into the swf at runtime and have the ability to draw its contents onto a BitmapData instance?

    Any thoughts on that possibility?

    peace :)

    Thursday, August 2, 2007 at 5:59 pm #
  8. Thibault Imbert wrote:

    Hi M,

    Thanks for your message :)

    That would be possible, but I think this would take a lot of time to achieve.

    AlivePDF will be also able to generate mars files which is the new PDF format that Adobe wants to introduce.

    The mars file is a just a zip file containing XML files which are describing each page and SVG files for the graphics.

    You can find more infos here :

    http://labs.adobe.com/technologies/mars/

    With this PDF format, we could do implement the opposite much faster and better :)

    cheers,

    Thursday, August 2, 2007 at 8:13 pm #
  9. Marc wrote:

    This looks incredible, I can’t wait to get my hands on it! I’m hoping to use this to do all my “printing” in my current project.

    I don’t know about others, but I sure would prefer a partially working, poorly documented version sooner than a complete version later so I can get started on some stuff :)

    Wednesday, August 8, 2007 at 3:46 pm #
  10. Kani wrote:

    Hi Thibault.. Excellent work! needless to say i’m also waiting to get my hands on this :). I’m wondering if filters like shadow, glow will also be supported??

    Friday, August 10, 2007 at 1:09 pm #
  11. Andreas wrote:

    Congratulations – impressive work – I’m looking forward to the beta! Feel free to set me to your notification list as an engaged beta tester.

    Wednesday, August 22, 2007 at 2:10 pm #
  12. this looks fantastic, when is going to be ready??

    Thursday, August 23, 2007 at 2:15 am #
  13. HighHolburn wrote:

    Amazing. Incredible. Exciting. Thank you.

    Thursday, August 23, 2007 at 6:17 am #
  14. Jon wrote:

    Any updates on the availability of the AlivePDF library per chance? Is there a possibility for early access to test it out in a possible application?

    There may be financial incentives if you consider this possibility. Please drop me a line if you would like to discuss more.

    Thursday, August 23, 2007 at 9:08 pm #
  15. KR wrote:

    Great work Thibault,

    Do you currently support gradients in drawing?

    Monday, September 10, 2007 at 9:42 am #
  16. Payal wrote:

    Hi
    I want to know how can i draw an icon from flex builder to pdf

    Thursday, September 13, 2007 at 2:26 pm #
  17. Ruggero wrote:

    Pure Magic!

    I’m definately gonna use this app at all time ;-)

    Q:
    I wonder if it’s possible to both activate and launch this from inside an AIR/Flash stage script – maybe calling an xml serverside doc – that is: Launched into a mediaframe on the AIR stage without the usual “accept download” popup..?

    Please put me on your mailing list.

    Ruggero

    Friday, November 2, 2007 at 3:02 pm #
  18. Adil wrote:

    Hi,
    I am using Alive PDF.i have tried the above code to generate all the line .circle and curves.but the problem is ‘PDFEncoder’ class is not found.there is no org.utils in new Alivepdf swc i have douwloaded from google code database.

    Monday, September 7, 2009 at 4:37 pm #
  19. simion314 wrote:

    Hi,great work!
    One question the parameters to the functions moveto(x,y) are expresed in points,pixels,the document unit?
    I am confused

    Monday, August 1, 2011 at 11:22 am #

Trackback/Pingback (1)

  1. AS3 PDF Creator AlivePDF Released (Alpha) « [ draw.logic ] on Thursday, September 13, 2007 at 10:30 am

    [...] Thibault Imbert from ByteArray released the first PDF Creator for AS3 / Flash 9 called AlivePDF. [...]