Cordova > iOS > Rotate > Landscape top margin

61 views
Skip to first unread message

Michael Lee

unread,
Jul 21, 2016, 12:52:12 PM7/21/16
to PDFTron WebViewer
BUILD: http://www.pdftron.com/ID-zJWLuhTffd3c/WebViewer/WebViewer_2.2.0.47449.zip

Rotate from Landscape to Portrait and back to Landscape reveals the following iOS behaviour:

Top-margin is introduced ~20% where dark-grey background is exposed and bottom ~20% content is off-screen.

Interesting to note the WebViewer menu is 100% at top, is not subjected to the ~20% offset; it appears internal to WebViewer hence seeking assistance.

Mike

Matt Parizeau

unread,
Jul 22, 2016, 8:46:21 PM7/22/16
to PDFTron WebViewer
Hi Mike,

Unfortunately iOS seems to have issues with orientation changes and iframes. See this post for previous discussion about it and a potential workaround: https://groups.google.com/d/msg/pdfnet-webviewer/dJUXzOQefOY/PVfWrPwY7GQJ


Matt Parizeau
Software Developer
PDFTron Systems Inc.

Michael Lee

unread,
Aug 2, 2016, 1:26:52 PM8/2/16
to PDFTron WebViewer
Hi Matt,

For iOS we currently refresh the entire viewport on rotation, a fix but not a solution for us.

Q. Is there anywhere I can subscribe to hear of a solution for this ?

Regards

Mike

Matt Parizeau

unread,
Aug 3, 2016, 1:44:54 PM8/3/16
to PDFTron WebViewer
Hi Mike,

We've played around a bit more with some of the workarounds and there is one that seems to work fairly well. The first step is to make sure the meta tag is on your outer html page:
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

The next thing to change is to add the following code to your config file:
var resize = ReaderControl.prototype.onResize;
ReaderControl.prototype.onResize = function() {
    document
.body.style.display = 'none';
    clearTimeout
(this.orientationChangeTimeout);
   
this.orientationChangeTimeout = setTimeout(function () {
      document
.body.style.display = 'block';
   
}, 250);

    resize
.apply(this, arguments);
};

This will basically hide and show the body briefly on a resize with forces the body to reflow. Let me know if this works for you in your environment!

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Michael Lee

unread,
Aug 4, 2016, 8:19:07 PM8/4/16
to PDFTron WebViewer on behalf of Matt Parizeau
Works 100% thank you. Mike

--
You received this message because you are subscribed to a topic in the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pdfnet-webviewer/jhUB_7GAwv8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pdfnet-webviewer+unsubscribe@googlegroups.com.
To post to this group, send email to pdfnet-webviewer@googlegroups.com.
Visit this group at https://groups.google.com/group/pdfnet-webviewer.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages