Can I print an HTMLLoader (pdf) in Adobe Air?
Posted
by Stephano
on Stack Overflow
See other posts from Stack Overflow
or by Stephano
Published on 2010-02-18T00:03:31Z
Indexed on
2010/03/08
3:09 UTC
Read the original article
Hit count: 336
I'm using AlivePDF to create a PDF file, then save it to the desktop. I can then use an HTMLLoader to display my lovely PDF file.
Now, the print button in Adobe Reader works fine. However, there will be young children using the app, so I'd like to have a big "Print" button right above it.
I figured I could just start up a print job and feed it my HTMLLoader. Am I doing something wrong here, cause I can't seem to get any output?
note: variable "stuff" below is my HTMLLoader. I also have access to the PDF file if that comes in handy.
private function print():void
{
var myPrintJob:PrintJob=new PrintJob();
var result:Boolean=myPrintJob.start();
if (result && stuff != null)
{
var rect:Rectangle=new Rectangle(0, 0, 2550, 3300);
var opt:PrintJobOptions=new PrintJobOptions(true);
myPrintJob.addPage(stuff, rect, opt);
myPrintJob.send();
}
else
{
//User does not have printer or user canceled print action
}
}
© Stack Overflow or respective owner