How to show only one page at a time in viewer

PDF.js Express Version
7.3.2

Detailed description of issue

  1. We want to show only one page at a time. Don’t want to display the first half of the next page. as shown in the image attached.
  2. We want to swipe the page horizontally instead of scrolling it vertically. Is it possible?

Please help us out with these issues mentioned above. Any help will be highly appreciated.
(upload://e2WhibKDTmJx9UhsWfFUfAnD7ow.png)[quote=“himanshu, post:1, topic:940, full:true”]

PDF.js Express Version

Detailed description of issue

  1. We want to show only one page at a time. Don’t want to display the first half of the next page. as shown in the image attached.
  2. We want to swipe the page horizontally instead of scrolling it vertically. Is it possible?

Please help us out with these issues mentioned above. Any help will be highly appreciated.
(upload://e2WhibKDTmJx9UhsWfFUfAnD7ow.png)

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:

Hi there,

Does this only happen with that specific document? Are you able to share the document with me?

Logan

Hi Logan,
I didn’t get you. Are you able to see the screenshot which I have attached above?

Hi,

Can you send me the actual file you are having issues with? I cannot debug with a screenshot.

Thanks,
Logan

Hi Logan,
Thanks for responding,
I am a little bit confused here. Are you asking me for the particular pdf file?
My issue is that

  1. We want to show only one page at a time. Don’t want to display the first half of the next page in viewer. as shown in the image attached how can we do it in pdfjs express?
  2. We want to swipe the page horizontally instead of scrolling it vertically. We went through the documentation and and found an api “instance.setSwipeOrientation()”. But it doesn’t seem to be working for us.

Hi there,

Sorry - I think I misunderstood your question. I thought you were running into a bug where half of one page was overlapping another (the PDF in your screenshot kind of looks like that).

To only show a single page at a time you can call:

instance.setLayoutMode(instance.LayoutMode.Single);

Once you do that then instance.setSwipeOrientation('horizontal') should work for horizontal scrolling.

Sorry about the confusion.

Logan

Thank you so much Logan, You really helped me out here. God Bless you bro,
Have a nice day

1 Like