use readercontrol on mobile device

69 views
Skip to first unread message

Samuele Panarotto

unread,
Jan 22, 2015, 8:04:40 AM1/22/15
to pdfnet-w...@googlegroups.com
Good morning,

is there a way to use ReaderControl instead of MobileReaderControl on a mobile device?

Thank you.

Matt Parizeau

unread,
Jan 22, 2015, 2:01:49 PM1/22/15
to pdfnet-w...@googlegroups.com
Hi Samuele,

You could modify the isMobileDevice as mentioned here: https://groups.google.com/d/msg/pdfnet-webviewer/0LkS8Re0BqM/QxsRDAyan8wJ
You would just change the function so that it always returns false.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Samuele Panarotto

unread,
Jan 23, 2015, 4:27:54 AM1/23/15
to pdfnet-w...@googlegroups.com
Hi Matt,

with this code:


 

var mobileCheck = PDFTron.WebViewer.prototype.isMobileDevice;

   
PDFTron.WebViewer.prototype.isMobileDevice = function() {

       
if (location.search.toLowerCase().indexOf('disablemobile') === -1) {

           
return mobileCheck.call(this); // or add your own code here

       
}

       
return false;

   
};

     

   
var webViewerObj = new PDFTron.WebViewer({

    type
: "html5",

.......}




on a Surface Tablet with IE11 I get always the same result, PdfTron use MobileReaderControl instead of ReaderControl, where I have wrong?


Thank you

Matt Parizeau

unread,
Jan 23, 2015, 11:19:39 AM1/23/15
to pdfnet-w...@googlegroups.com
Hi Samuele,

The example I linked was just to show you how to override the isMobileDevice function. If you want to always use ReaderControl instead of MobileReaderControl then you can simply return false from the function. The part with mobileCheck is just extra for that particular situation.

For your case:
PDFTron.WebViewer.prototype.isMobileDevice = function() {
   
return false;
};

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Samuele Panarotto

unread,
Jan 28, 2015, 3:32:30 AM1/28/15
to pdfnet-w...@googlegroups.com
It works, thank you.
Reply all
Reply to author
Forward
0 new messages