Copy link to clipboard
Copied
Gidday guys
Today I'm researching using AS3 AIR to format and print data from a database.
It needs to...
- take the data, and format it from a selection of page formats I present
- either print it to the printer, or save it to a pdf
I'm wondering if someone with experience can please nudge me in the right research direction to answer...
- what's the process for taking data and formatting it into an object to be printed of turned into a pdf?
- is the object you make for printing a sprite? ie for multi page printing, do you create multiple sprites that contain your data formatted a particular way, and then create a multipage document out of them.
Cheers for your guidance.
Without having to rely on the user having a PDF-driver installed on her/his machine you will need a library like AlivePDF to let him print out to pdf.
A workflow could be: Retrieving your needed data via php/Flashvars>filling your prepared document Template>using AlivePDF to print out to pdf.
Copy link to clipboard
Copied
for printing, create print page sized sprites or movieclips laid out exactly the way you want your printed page to appear. i create the printjob, then access its pageHeight and pageWidth properties
Copy link to clipboard
Copied
Hey kGlad
That's what I was hoping.
But I've been playing with AlivePDF for a couple of hours, and it looks pretty powerful.
Have you had experience with it, and if so, what would be a couple of reasons you'd go with either the way you mentioned in your post, or AlivePDF?
Thanks mate.
Copy link to clipboard
Copied
yes, i tried to use alivePDF for something a few years ago and found that it could not do what i wanted. i can't remember what that was but there are definite limitations.
whereas the print method i sketeched allows pixel-perfect creation of what you want printed.
p.s. you can assume the user has a pdf viewing capability or you probably shouldn't be using alivePDF. what will they do with the pdfs?
Copy link to clipboard
Copied
OK - I've avoided AlivePDF, and used printJob after a flowComposer has compiled the pages to be printed from a loop. I'll leave it up to the user if they print to paper, or to pdf using thier own pdf converter.
Thanks kGlad
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
Without having to rely on the user having a PDF-driver installed on her/his machine you will need a library like AlivePDF to let him print out to pdf.
A workflow could be: Retrieving your needed data via php/Flashvars>filling your prepared document Template>using AlivePDF to print out to pdf.
Copy link to clipboard
Copied
I forgot to mention is for a desktop AIR app.
So rather than use the AlivePDF api for creating the layout etc, do that myself, and then just send the result to AlivePDF?
Copy link to clipboard
Copied
No that won`t work. AlivePDF uses its own method of embedding fonts (if I remmeber correct you can only use ttf not otf font formats). AlivePDF is not exactly well documented or much used. Its technics are a little "arcane". It was created by the same Guy whose brainchild was Stage3D so you can imagine how complex it is for us mere mortals. A good start is this little blog .
I also can see why Adobe (who is his boss) isn`t exactly highly motivated to make AlivePDF too much of a Acrobat Double 😉
Copy link to clipboard
Copied
Arcane is an apt word!!!
The API at Adobe doesn't always match with the class methods - I had to look at the flex page that comes with the source files to figure out the correct number and order or arguments. Plus, when you look through blog and forum posts, their info is useless unless you can figure which API version they refer to.
I might stick with it for a few more hours to see if I can tweek it to what I need - it's seems pretty powerful, but yeah - very vague and mostly non existent docs.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now