
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 :
Comments (18)
this is absolutely great!
i wonder why adobe hasn’t come up with support between flash and pdf.
keep going!
plugisto
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
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 !
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
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
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
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
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,
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
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??
Congratulations – impressive work – I’m looking forward to the beta! Feel free to set me to your notification list as an engaged beta tester.
this looks fantastic, when is going to be ready??
Amazing. Incredible. Exciting. Thank you.
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.
Great work Thibault,
Do you currently support gradients in drawing?
Hi
I want to know how can i draw an icon from flex builder to pdf
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
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.
Trackback/Pingback (1)
[...] Thibault Imbert from ByteArray released the first PDF Creator for AS3 / Flash 9 called AlivePDF. [...]