Set FitMode of mobile WebViewer

170 views
Skip to first unread message

Christian Gruber

unread,
Jun 19, 2018, 1:21:57 PM6/19/18
to pdfnet-w...@googlegroups.com
I would like to set the FitMode "FitWidth" to a mobile WebViewer. When I try to call:

webViewer.setFitMode('FitWidth');

I get a "Unsupported method for this viewer type" response.

Is it even possible to set the FitMode on mobile WebViewers? 

WebViewer Version 3.1

Matt Parizeau

unread,
Jun 20, 2018, 6:28:39 PM6/20/18
to PDFTron WebViewer
Hi Christian,

It currently isn't possible to set the fit mode in the mobile viewer. You can simulate a fit width by calculating the zoom level based on the viewport size and then setting it, for example https://groups.google.com/forum/#!topic/pdfnet-webviewer/nr7iX_UA6ek

You may want to check out the beta UI that we recently released (https://www.pdftron.com/documentation/web/guides/ui-beta/getting-started) which uses the same viewer for both mobile and desktop and does support fit modes. You can try out a demo of the new viewer here https://www.pdftron.com/webviewer/demo/.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Christian Gruber

unread,
Jun 26, 2018, 1:00:23 PM6/26/18
to PDFTron WebViewer
Hi Matt, 

thanks for the info. I will take a look in the solution you provided.

The new design looks promising! But when following the procedure to download the new trial I still receive a copy of the current (old) WebViewer. Do you have a proper download link? It's still in Beta, when is it going to be released? Will our current licenses still be valid for the new version? 

Best regards, 

Christian

Christian Gruber

unread,
Jun 26, 2018, 1:00:23 PM6/26/18
to PDFTron WebViewer
Hi Matt, 

the solution you provided for the current version is very outdated. 

I achieve "FitWidth" by doing: 

var pageWidth = webViewer.getInstance().getDocumentViewer().getDocument().getPageInfo(webViewer.getInstance().getDocumentViewer().getCurrentPage() - 1).width;
webViewer.setZoomLevel($iframe.width() / pageWidth, false); // the iframe contains the webViewer

The zoom gets updated correctly, the page fits entire width. The problem that I have now is that the zoom is centered in the middle of the page. I would like to display the page from "top to bottom". 

Furthermore, when calling this function on a mobile device, I get these messages:

Page 0 no longer visible

endlessly. Something seems to be stuck in a loop. Prior to these messages, I get a:

Unsupported method for this viewer type.

I don't think I can ignore these messages, do I? 

Greets

Christian

David Compton

unread,
Jun 27, 2018, 12:51:04 PM6/27/18
to PDFTron WebViewer on behalf of Ryan - PDFNet Developer
Hi Christian,

I am interested in the answer from Matt to your other questions.  But you will find you can download the trial from a link on this page: https://www.pdftron.com/documentation/web/guides/ui-beta/getting-started/

Kind regards,

David

--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webview...@googlegroups.com.
To post to this group, send email to pdfnet-w...@googlegroups.com.
Visit this group at https://groups.google.com/group/pdfnet-webviewer.
For more options, visit https://groups.google.com/d/optout.

Matt Parizeau

unread,
Jun 27, 2018, 7:06:52 PM6/27/18
to PDFTron WebViewer
Hi Christian,

You're right, I think this is actually the post I should have linked you to as it is more up to date https://groups.google.com/d/msg/pdfnet-webviewer/tZhmb7ekA3k/Lah_xdIvAQAJ.

You can download the beta from the link David posted assuming you're downloaded a trial or if you go to "Support > Sign in" and enter your license key. The direct download link is pdftron.com/downloads/webviewer-ui-beta.zip if you're having trouble getting either of those to work. Currently this download has the source minified but we will be releasing the unminified source and can send you a download link now if you're interested.

The current plan is to include the beta version in the next WebViewer release, still technically as a beta release, but it will be in the normal WebViewer.zip and you can easily switch to it with a WebViewer constructor option. This should likely be happening in the next 1-2 months.

Current licenses will still be valid for the new UI. The changes are to the UI layer and the core WebViewer APIs will still be the same. Eventually in a future version this UI will become the default but we don't have a timeline yet for when that transition will happen. We expect that we'll still support the current UI for some time.

Matt Parizeau
Software Developer
PDFTron Systems Inc.


On Wednesday, June 27, 2018 at 9:51:04 AM UTC-7, David Compton wrote:
Hi Christian,

I am interested in the answer from Matt to your other questions.  But you will find you can download the trial from a link on this page: https://www.pdftron.com/documentation/web/guides/ui-beta/getting-started/

Kind regards,

David

On Wed, 27 Jun 2018 at 03:00, Christian Gruber via PDFTron WebViewer <pdfnet-webviewer+APn2wQemGE0RTRTaEnwsi4Cga2eTq3zl9MkK80VXax2V9W-@googlegroups.com> wrote:
Hi Matt, 

thanks for the info. I will take a look in the solution you provided.

The new design looks promising! But when following the procedure to download the new trial I still receive a copy of the current (old) WebViewer. Do you have a proper download link? It's still in Beta, when is it going to be released? Will our current licenses still be valid for the new version? 

Best regards, 

Christian

--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webviewer+unsubscribe@googlegroups.com.
To post to this group, send email to pdfnet-webviewer@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages