flex air show pdf preview
var bytes:ByteArray = urlloader.data as ByteArray; i use the TIFFbaselineDecoder to decode the bytes and open a popup to show the bitmap. Works nicely.
Now, i 开发者_如何学编程want to do the same thing for a pdf file. How can i show the pdf file in a window from the bytearray.
Please let me know.
Thanks
VishFirst, you can check if the user's machine is suitable for PDF display
if(HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK){
trace("PDF content can be displayed");
}
else {
trace("PDF cannot be displayed. Error code:", HTMLLoader.pdfCapability);
}
If so, then
var request:URLRequest = new URLRequest("http://www.example.com/test.pdf");
pdf = new HTMLLoader();
pdf.height = 800;
pdf.width = 600;
pdf.load(request);
container.addChild(pdf);
Mind you, this works too :
<mx:HTML width="100%" height="100%" location="understanding_the_flex_3_lifecycle_v1.0.pdf"/>
精彩评论