Override the pinch zoom in iPad/Android HTML5 PDF viewer with a double tap to a fixed zoom.

508 views
Skip to first unread message

Support

unread,
Apr 4, 2012, 10:16:52 PM4/4/12
to PDFTron WebViewer
Q: We wanted to override the pinch zoom in Mobile PDF viewer for iPad/
Android and replace with a double tap to a fixed zoom ratio. Is this
possible and then have control over the page navigation in the zoomed
state.

So to clarify – double tap zoom, double tap again unzoom.

--------------

A: jQuery mobile, does not have a double tap event so you would need
to use a different library.

For example, you could use the approach described on the following
page http://appcropolis.com/blog/implementing-doubletap-on-iphones-and-ipads/.
Once you have the event you can do something like the following:

var zoomed = false;
$(document).bind(“doubletap”, function(){
If (zoomed === false){
zoomed = true;
//zoom to 250%
me.docViewer.ZoomTo(2.5);
}else{
zoomed = false;
//zoom to 100%
me.docViewer.ZoomTo(1);
}
});

ch...@cwfent.com

unread,
Jun 13, 2013, 11:42:28 AM6/13/13
to pdfnet-w...@googlegroups.com
Is it possible to have this functionality with the non-mobile, aka the ReaderControl.js?

TIA

Matt Parizeau

unread,
Jun 13, 2013, 12:32:18 PM6/13/13
to pdfnet-w...@googlegroups.com
Hi,

We don't recommend using the desktop viewer on mobile devices if that's what you mean.  However if you wanted a double click zoom, or double tap for devices that use the desktop viewer but also have a touch interface then yes it is possible, probably by doing something similar to the code posted above.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

ch...@cwfent.com

unread,
Jun 13, 2013, 2:40:03 PM6/13/13
to pdfnet-w...@googlegroups.com
Yes, sorry I didn't mean mobile. I was talking about the regular HTML5 viewer that appears when using ff, ie, chrome etc on your desktop. That's where I'd really like to be able to also click zoom.

Thanks!
-Chris
Reply all
Reply to author
Forward
0 new messages