Jump to content

Mobile PdfFrame Pan / Zoom random errors ?


andyhill

Recommended Posts

I am using the Mobile PdfFrame and when displaying a PDF file containing an image of approx 800 x 800..1600 I get random errors during panning and zooming:-

 

"webkit error"

 

"a problem repeatedly occurred"

 

"error encountered"

 

etc.

 

In all occasions it takes out the current session. Sometimes it shows in safari as a warning that the site is faulty. 

 

Please advise how to resolve.

 

To test simply build a similar PDF and pan and zoom on iPhone.

post-5752-0-63722300-1515490985_thumb.png

Link to comment
Share on other sites

It makes no difference whether it is one page of text, one page of image, many pages of text or many pages of images.

 

Platform: iPhoneX, iOS 11.2.1, Safari

 

I have seen the same problem on Android (I will endeavor to get version).

Link to comment
Share on other sites

I don't know if this helps, but I get the same error when i rotate the device whilst viewing a pdf. I am currently using an iPad.

 

It seems it's only reproducible if you rotate while the pdf is loading from a previous rotate.

 

This is using the demo code, so i guess is it's something to do with the onshow event, as this is when the pdf is loaded for some reason. I'm going to swap this out to load the pdf on form create to see if it helps.

 

Sent from my Pixel using Tapatalk

Link to comment
Share on other sites

Further testing on iPhone appears to show that the PDFFrame object has trouble staying within (linked to) the ParentForm or optionally the ParentContainer of the ParentForm ?

 

Is there some sort of java script required to tell the frame who the parent form is ?

 

There is no apparent issue on Desktop.

Link to comment
Share on other sites

  • 2 weeks later...

Farshad, With lots of testing on an iPhoneX with the TUnimPDFFrame component I can report the following (I have no problems with Desktop emulation):-

 

1) It appears the errors occur after a certain zoom event value is exceeded (not sure at what zoom level this is [no feed back]) other than larger than would normally be required

 

2) The over-zoomming also effects the Form sizing as well ??? (see images below [non-zoomed and over-zoomed but not reached crash threshold at this level])

 

So, for the further purposes of testing I need to catch the zoom event and put limits on how far one can zoom - say cannot zoom past 200% for starters

 

Also, how can we stop the Form and it's Title from being effected by the over zooming ?

 

Please provide the necessary code to implement the Zoom Event with Zoom Limit - thanks.

 

 

post-5752-0-45725500-1519759188_thumb.png

post-5752-0-86501900-1519759198_thumb.png

Link to comment
Share on other sites

Looking through the viewer.js code I see:-

 

...
 
 
      if (pdfjsLib.PDFJS.useOnlyCssZoom) {
        var actualSizeViewport = viewport.clone({scale: CSS_UNITS});
        // Use a scale that will make the canvas be the original intended size
        // of the page.
        outputScale.sx *= actualSizeViewport.width / viewport.width;
        outputScale.sy *= actualSizeViewport.height / viewport.height;
        outputScale.scaled = true;
      }
 
 
...
 
 
 
      if (pdfjsLib.PDFJS.maxCanvasPixels > 0) {
        var pixelsInViewport = viewport.width * viewport.height;
        var maxScale =
          Math.sqrt(pdfjsLib.PDFJS.maxCanvasPixels / pixelsInViewport);
        if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
          outputScale.sx = maxScale;
          outputScale.sy = maxScale;
          outputScale.scaled = true;
          this.hasRestrictedScaling = true;
        } else {
          this.hasRestrictedScaling = false;
        }
      }
 
 
For testing purposes how do I set:-
 
1) useOnlyCssZoom
 
2) maxCanvasPixels
 
3) maxScale
 
 
I need to resolve this issue urgently - please advise.
Link to comment
Share on other sites

×
×
  • Create New...