Skip to main content
February 19, 2013
Answered

Printing database content, or creating a pdf from it

  • February 19, 2013
  • 2 replies
  • 1682 views

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.

This topic has been closed for replies.
Correct answer moccamaximum

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.

2 replies

moccamaximumCorrect answer
Inspiring
February 19, 2013

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.

February 19, 2013

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?

Inspiring
February 19, 2013

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 ;-)

kglad
Community Expert
Community Expert
February 19, 2013

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

February 19, 2013

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.

kglad
Community Expert
Community Expert
February 19, 2013

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?