7 Replies Latest reply on Nov 18, 2009 2:06 AM by Yi-Nan

    PDF from HTMLLoader is Not Displaying in a Container

    randyfong

      PDF from HTMLLoader is Not Displaying in a Container

       

      Was there a new version of AIR released recently that breaks the display of a PDF through the HTMLLoader?

       

      I've been experiencing problems displaying a PDF in a container lately.

       

      AIR applications that worked a couple weeks ago, are not working now even though no changes have been made to the source.

       

      To focus on the problem, I created an application that narrows my focus to the broken feature. It's sole purpose is to display a simple PDF through AIR.

       

      The example can be found here.

       

      http://www.appfoundation.com/blogs/giametta/2009/04/14/render-pdf-in-adobe-air-with-pdf-sc aling/

       

      The code used is exactly the same as the one found in the above example, except I swapped the url of the PDF to the following.

       

      http://www.sfbike.org/download/map.pdf

       

      It's pretty straightforward.

       

      But, when I compile and press the "do it" button, nothing displays in the VBOX.

       

      Using an HTTP Sniffer the "GET" to my url seems to be working fine and, I get a "200 OK" return status, but nothing is displayed in the container.

       

      Here is my configuration.

       

      - Windows Vista Ultimate 64 bit
      - AIR 1.5
      - Flex 3.0.2
      - Adobe Acrobat 9 Pro
      - Firefox 3.5.4

       

      Attached is the source code mxml as a txt.

        • 1. Re: PDF from HTMLLoader is Not Displaying in a Container
          joshuajnoble

          This is most likely due to the operating system blocking access to the file. I'm not sure exactly how AIR loads files at the OS level, but how it does it causes file open requests to frequently be refused on Win7 and Vista. Try running your application as administrator and see if that fixes the problem, if it does, then you know that's it's a matter of how AIR interacts with the OS. Unfortunately I don't know of a fix for this, other than to run the app as admin.

          • 2. Re: PDF from HTMLLoader is Not Displaying in a Container
            randyfong Level 1

            Thanks for the reply, but unforntuately that doesn't solve my problem.

             

            I am already logging on as an administrator.  Just to be sure, I ran the application under the  "Run as an administrator" option, too and the PDF still doesn't display.

            • 3. Re: PDF from HTMLLoader is Not Displaying in a Container
              joshuajnoble Level 1

              Well, that's the first idea down then. I tried running it on OSX and I needed change the HTMLLoader settings:

               

              pdf.placeLoadStringContentInApplicationSandbox = true;


              for it to load properly. It then crashed the AIR runtime, so I'm not sure what that's about, but it might be a problem with the PDF possibly? It loads fine in Adobe Reader, so I'm not sure.

              • 4. Re: PDF from HTMLLoader is Not Displaying in a Container
                randyfong Level 1

                Setting the Load String Contest in Application Sandbox property to true is an interesting suggestion. I've never set that property before.

                 

                pdf.placeLoadStringContentInApplicationSandbox = true;

                But, unfortunately I still don't get a PDF to display after setting this property to true.

                • 5. Re: PDF from HTMLLoader is Not Displaying in a Container
                  joshuajnoble Level 1

                  Well, like I said, I don't either. Even when loading a very simple PDF, I just see this crash:

                   

                  Process:         adl [1003]
                  Path:            /Users/base/c_languages/flashplayer/flex_sdk_4.0.0.10079/bin/adl
                  Identifier:      adl
                  Version:         ??? (???)
                  Code Type:       X86 (Native)
                  Parent Process:  FlashBuilder [217]

                   

                  Date/Time:       2009-11-04 11:41:13.050 -0800
                  OS Version:      Mac OS X 10.6.1 (10B504)
                  Report Version:  6

                   

                  Interval Since Last Report:          1807020 sec
                  Crashes Since Last Report:           7
                  Per-App Crashes Since Last Report:   4
                  Anonymous UUID:                      E63961B9-2C86-42EA-9FBA-0D3F0561CBB8

                   

                  Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
                  Exception Codes: KERN_INVALID_ADDRESS at 0x0000000040918216
                  Crashed Thread:  0  Dispatch queue: com.apple.main-thread

                   

                  Maybe someone on the AIR team will have a more knowledgable response, it looks like a problem with how Webkit is loading up the PDF viewer perhaps.

                  • 6. Re: PDF from HTMLLoader is Not Displaying in a Container
                    Jose Wong Adobe Employee

                    Hi Randy,

                     

                    If you have just recently upgraded Acrobat/Reader to 9.2, you will also need to upgrade AIR to the latest 1.5.2 update located at:

                    http://get.adobe.com/air/

                     

                     

                    Thanks,

                    Jose

                    • 7. Re: PDF from HTMLLoader is Not Displaying in a Container
                      Yi-Nan

                      Besides upgrading the runtime to 1.5.2.8900, the AIR SDK inside FlexBuilder also need to upgraded if you plan to debug with FlexBuilder.

                       

                      To do that, copy everything inside the AIR SDK folder and paste them into the Flex SDK to overwrite the old AIR SDK. Then your Flex SDK is upgraded with the new AIR SDK. And for Mac user, before copy the AIR SDK to Flex SDK, execute following command in your terminal:

                       

                      /bin/chmod -R 755 "/Applications/Adobe Flex Builder 3/sdks/3.2.0"