6 Replies Latest reply: Aug 6, 2010 12:24 AM by Narayan S S RSS

    PDF opens at second page in HTMLLoader

    Narayan S S Community Member

      Hi,

       

      I created an offline AIR application to browse and view our product manuals.When the user selects a pdf, HTMLLoader displays the pdf in a pane. Things were working as designed in AIR 1.5. When we updated the runtime to AIR 2.0, the pdf opens in the second page instead of the first page. Frustrating situation since the second page is the copyright page and users get annoyed by all the little sentences which are hard to read. Issue still exists in 2.0.2.

        • 1. Re: PDF opens at second page in HTMLLoader
          chris.campbell Adobe Employee

          Hi,

          Is it possible to get some sample code that displays this behavior?  I just tried with the following code with 2.0.2 and was unable to reproduce the problem.

           

          Thanks,

          Chris

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                      xmlns:s="library://ns.adobe.com/flex/spark" 
                                      xmlns:mx="library://ns.adobe.com/flex/mx"
                                      creationComplete="init()">
               <fx:Declarations>
                    <!-- Place non-visual elements (e.g., services, value objects) here -->
               </fx:Declarations>
               
               <fx:Script>
                    <![CDATA[
                         import mx.core.UIComponent;
                         private function init():void
                         {
                              if(HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK) 
                              {
                                   var request:URLRequest = new URLRequest("http://www.adobe.com/products/acrobat/pdfs/pdfaccess.pdf");
                                   var pdf:HTMLLoader = new HTMLLoader();
                                   pdf.height = 800;
                                   pdf.width = 600;
                                   pdf.load(request);
                                   
                                   var container:UIComponent = new UIComponent();
                                   addElement( container );
                                   
                                   // displayObject goes to container
                                   var displayO:Sprite = new Sprite();
                                   container.addChild( pdf );
                              }
                              else 
                              {
                                   trace("PDF cannot be displayed. Error code:", HTMLLoader.pdfCapability);
                              }
          
                         }
                    ]]>
               </fx:Script>
          </s:WindowedApplication>
          

          • 2. Re: PDF opens at second page in HTMLLoader
            LancerRick Community Member

            Chris,

             

            I also have this same problem and it started when moving to AIR 2.0. In my case there are a couple of extra clues.

            • It happens with local content that ends up using a "file:" protocol.
            • It happens on multiple machines for different users.
            • The same file loaded several times in a row (each with a new instance of the HTML component) will display page 2 most but not every time.
              • The really odd thing is that the pattern is not repeatable even when closing and reopening the application.
            • Some files exhibit the problem regularly and others do not as if there is something different about the PDF content.
            • I cannot repeat the problem when opening the same files in the standalone Adobe Reader or FireFox browser.
            • The scrollv property is set at 0 even while displaying page 2.

             

            I hope that helps because it is an annoying problem.

             

            Thanks,

            Rick

            • 3. Re: PDF opens at second page in HTMLLoader
              chris.campbell Adobe Employee

              Hi Rick,

              Thanks for the extra data points!  Is it possible to get a copy of the pdf's that encounter this problem?  Please feel free to email me at ccampbel@adobe.com with any samples (pdf, code, and/or compiled air app) you can provide.

               

              Thanks,

              Chris

              • 4. Re: PDF opens at second page in HTMLLoader
                Narayan S S Community Member

                Hi Chris,

                 

                I have sent you the code and a sample pdf. Thanks for  your time.

                 

                Narayan

                • 5. Re: PDF opens at second page in HTMLLoader
                  chris.campbell Adobe Employee

                  Thank you guys for the sample code and pdf's.  I've been able to reproduce this on Windows (25 - 50% of the time.)  I've been unable to repro on Mac, please let me know if you see it there too.  I've added an internal bug (#2685024) with a link back to this post for further investigation.

                   

                  Thanks,

                  Chris