AS3 - Loading PDFs Into Flash
In my application I need to load PDFs dynamically and store each page o开发者_高级运维f the PDF.
Currently what I'm doing is converting each page to an image using some php code and then importing each image to flash, but I was wondering if there is a better way.
Any ideas? Or is converting to images then importing to flash the best option?
Theres no built in way to decode or display pdfs in flash. Putting that into the plugin would make the initial download larger. It's the same reason why every flex sdk isn't included in the flash plugin download. The best way to emulate this functionality would be to convert the pdf to a swf on the server and load the swf into your application. You can use the GPL project pdf2swf found here http://www.swftools.org/ . Each page of the pdf becomes a frame of the swf and text/images/tables are maintained.
But if by 'better way' you meant more native way then no, there is not a better way than conversion.
I had a similar issue recently, and used the same solution : pdf to image conversion. I still don't understand why Adobe didn't add some pdf import capabilities to Flash. I believe that it's your only option if you need to load your files dynamically.
精彩评论