Jump to content
uniGUI Discussion Forums
andyhill

Mobile PdfFrame Pan / Zoom random errors ?

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

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites

Hi,

 

Please, can you make a simple testcase for this?!

 

Best regards,

Share this post


Link to post
Share on other sites

As mentioned, it is not code specific nor pdf specific, knock up any mobile PdfFrame and load any PDF file and zoom / pan all over the place and it will crash.

Share this post


Link to post
Share on other sites

Hi,

 

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

 

I couldn't reproduce this issue

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

On iPhone it happens without rotating but is related to zooming and panning.

 

 

post-5752-0-84923300-1515956904_thumb.png

Share this post


Link to post
Share on other sites

I have tried but I can't pin point the issue. It happens often enough that it will cause a real issue for my customers.

Any ideas?

 

Sent from my Pixel using Tapatalk

Share this post


Link to post
Share on other sites

Is it possible that a Zoom event is interrupted by a Pan event (or visa versa), in other words there is no logic to prevent re-entry while executing ?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Farshad, I really need a fix for this ASAP.

 

Please test mPDFFrame component on iPhone (it intermittently crashes on iPhoneX, iPhone7 etc. irrespective of PDF image) when one zooms in/out and pans around.

Share this post


Link to post
Share on other sites

Any news on this? I am having very similar issues using the iPad air.

 

Sent from my Pixel using Tapatalk

Share this post


Link to post
Share on other sites

Farshad, As you can see it is not an isolated issue with my project.

 

It is a problem with both iOS and Android.

 

Can you please provide a work around ASAP - thanks.

Share this post


Link to post
Share on other sites

Farshad, I can only assume you have no idea how to fix at present by your lack of response ?

 

Please advise that you are looking into it as it is a real problem (test it yourself on an updated iPhone).

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×