Accessibility
Adobe
Sign in My orders My Adobe

Title

Loading a Password Protected PDF in a Flex based AIR applicationProducts affected

Issue

Loading a password protected PDF document inside a Flex based AIR application from the creationComplete event of the WindowedApplication causes the AIR application to hang or not render properly if you click the Cancel button on the PDF password prompt.

Solution

Instead of loading the PDF from the creationComplete event, use the invoke event from the WindowedApplication.

Note the use of the invoke argument in the WindowedApplication:

<mx:WindowedApplication 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    width="600" 
    height="600" 
    invoke="loadPDF()">

Here is the function that loads the PDF into an HTML component:

private function loadPDF():void {
    // check that the client is able to open PDFs 
    if (HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK) {
        var request:URLRequest = new URLRequest("test.pdf"); 
        var pdf:HTMLLoader = new HTMLLoader(); 
        pdf.height = 500; 
        pdf.width = 500; 
        pdf.load(request); 
        myHTML.location = pdf.location; 
    } 
    else { 
        trace("Unable to open PDF docs!"); 
    } 
}

Here is the HTML component which has its location set in the loadPDF() function above:

<mx:HTML id="myHTML" width="500" height="500"/>

Additional information

http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7eb4.html

http://cookbooks.adobe.com/post_How_do_I_use_command_line_arguments_with_my_AIR_ap-8003.html

 

 

 


Doc ID
(cpsid_53161)

Last updated
2010-02-03

OS
Windows (All)

Products affected

Contacting Adobe Support

Still need help?
Find out about all your support options.
Contact support