Reputation: 827
I am using urlloader to load a tiff file from the server.
Then i get it as ByteArray and show the image in a popup window.
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
Vish
Upvotes: 1
Views: 1092
Reputation: 825
First, 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"/>
Upvotes: 1