开发者

flex air show pdf preview

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


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"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜