简体   繁体   English

在Flex air中显示pdf

[英]Show pdf in Flex air

I went through a document at Adobe Livedocs that describes working with pdf: http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html 我浏览了Adobe Livedocs上的一个文档,该文档描述了使用pdf的方法: http ://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html

But I'm stuck with it and can't get it to work. 但我坚持使用它,无法使其正常工作。

Can anyone help me? 谁能帮我?

thanks Vladimir 谢谢弗拉基米尔

Adobe Air relies on the Adobe Reader browser plugin to render the PDF files. Adobe Air依靠Adobe Reader浏览器插件来呈现PDF文件。 So a user of the AIR application will have to have Adobe Reader installed. 因此,AIR应用程序的用户必须安装Adobe Reader。 This also means that any customization that might have been done by the user to the Adobe Reader interface will be reflected in their AIR app. 这也意味着用户可能对Adobe Reader界面进行的任何自定义都会反映在其AIR应用程序中。

This being said, do you have Adobe Reader installed? 话虽这么说,您是否已安装Adobe Reader? It has to be at least version 8.1. 它必须至少是8.1版。

You could put a breakpoint in the code below where it checks the pdfCapability and it will tell you whether it supports pdf. 您可以在下面的代码中放置一个断点,以检查pdfCapability,并告诉您是否支持pdf。

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    layout="absolute" 
    creationComplete="onCreationComplete()">

    <mx:Script>
        <![CDATA[
            import mx.core.UIComponent;

            public function onCreationComplete():void
            {
                if(HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK)
                {
                    var htmlLoader:HTMLLoader = new HTMLLoader();
                    var pdfUrl:URLRequest = new URLRequest("http://www.adobe.com/devnet/flex/pdfs/getting_started_with_Flex3.pdf"); 
                    htmlLoader.load(pdfUrl);
                    htmlLoader.width = 1024;
                    htmlLoader.height= 768;
                    pdfComponent.addChild(htmlLoader);
                }
            }
        ]]>
    </mx:Script>
    <mx:VBox>
        <mx:Label text="pdf below:" />
        <mx:UIComponent id="pdfComponent"  />
    </mx:VBox>  
</mx:WindowedApplication>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM