Skip navigation
Narayan S S
Currently Being Moderated

PDF opens at second page in HTMLLoader

Aug 2, 2010 4:06 AM

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.

 
Replies
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    Aug 3, 2010 1:45 PM   in reply to Narayan S S

    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>
    

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 4, 2010 8:17 AM   in reply to Chris Campbell

    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

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    Aug 4, 2010 9:40 AM   in reply to LancerRick

    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

     
    |
    Mark as:
  • Chris Campbell
    9,456 posts
    May 4, 2010
    Currently Being Moderated
    Aug 5, 2010 2:03 PM   in reply to Narayan S S

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points