WebViewer - Horizontal Page Navigation

I am aware the WebViewr has a vertical continuous page transition option which allows the user to navigate between pages using up and down arrow keys. Is there a feature for horizontal page navigation for the Webviewer, where the left and right arrow keys would be used to navigate between pages?

  • Dante

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello Dante,

Here is a code snippet to implement this functionality:

  docViewer.on("keyDown", (e) => {
    const LEFT_KEYCODE = 37;
    const RIGHT_KEYCODE = 39;
    let code = e.keyCode || e.which;
    if (code === LEFT_KEYCODE) {
      e.preventDefault()
      instance.goToPrevPage();
    } else if (code === RIGHT_KEYCODE) {
      e.preventDefault()
      instance.goToNextPage();  
    }
  });

Using the event keyDown, you are able to check the keycode and iterate through each page using instance.goToPrevPage() and instance.goToNextPage()
You can read more on DocumentViewer events here: PDFTron WebViewer Class: DocumentViewer

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.

1 Like

Tyler,

Thanks for the solution. So pdftron does not have a feature I can simply enable which would allow a user to continuously navigate horizontally? If so will pdftron be including this feature in the future?

-Dante

Hi Dante,

We currently do not have a feature to simply enable for continuous horizontal navigation. We’ve added the feature to our backlog to be worked on in the future. We don’t have a timeline for when it will be available but if it does get worked on we’ll let you know when it’s available in an experimental build to test out and the estimated official release date.

If this is a critical improvement for you, and you need a fixed timeline for this to be completed by, then the next step would be to do a paid custom engineering project. If you are interested in that, please fill in this form.

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.

1 Like