I created a swf file in Adobe FlashBuilder 4.6 web version and I want interactive PDF. I successfully embed this swf inside PDF with the help of java iText PDF library.
My problem is when I click a print button it gives below error
Error #2057: The page could not be added to the print job.
at Error$/throwError()
at flash.printing::PrintJob/addPage()
My code is
private function doPrint(event:MouseEvent):void {
var printJob:FlexPrintJob = new FlexPrintJob();
if(printJob.start())
{
var thePrintView:FormPrintView = new FormPrintView();
FlexGlobals.topLevelApplication.addElement(thePrintView);
thePrintView.width=printJob.pageWidth;
thePrintView.height=printJob.pageHeight;
thePrintView.padg.dataProvider = allGrid.dataProvider;
printJob.addObject(thePrintView);
thePrintView.pageNumber++;
while(true) {
thePrintView.padg.nextPage();
if (!thePrintView.padg.validNextPage) {
printJob.addObject(thePrintView);
break;
} else {
printJob.addObject(thePrintView);
thePrintView.pageNumber++;
}
}
FlexGlobals.topLevelApplication.removeElement(thePrintView);
}
printJob.send();
}