AlivePDF addImage() bug yields ArgumentError: Error #2015 Invalid BitmapData
I’ve recently been using the open-source AlivePDF AS3 library to satisfy a client’s request for printing a PDF from a Flash movie. It’s a handy library–and something that would be handy to have built into Flash (then again, maybe Adobe Mars will take over).
While trying to print out a screen capture of my SWF I came across a pesky runtime error. I’ve since posted to the AlivePDF open issues list, but I figured I’d post here (below) to help further help anyone searching for the issue.
What steps will reproduce the problem?
Basically, I’ve attempted to pass a parent of a DisplayObject or variable reference to a DisplayObject instance in my class. Examples:
myPDF.addImage(this);
myPDF.addImage(MovieClip.stage);
myPDF.addImage(MovieClip.parent);
What is the expected output? What do you see instead?
I wanted to take a screen capture instance of my entire SWF, but instead I’d get the following runtime error: ArgumentError: Error #2015 Invalid BitmapData.
The problem I found was on line 3190 of org.alivepdf.pdf.PDF.as. Using FlashTracer, I determined that the following values were being passed into the addImage function:
displayObject.width:44038179.6
displayObject.height:16513228.8
When I alternatively hard code the values, the PDF prints fine:
var bitmapDataBuffer:BitmapData = new BitmapData (1000, 600, false);
What version of the product are you using? On what operating system?
I’m using AlivePDF 0.1.4.8 with Flash CS3 and TextMate on MacOSX Leopard
