mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.32k stars 9.97k forks source link

Function suggestion: Horizontal Scrolling from right to left #11154

Open heangfat opened 5 years ago

heangfat commented 5 years ago

Attach (recommended) or Link to PDF file here:

Configuration:

Steps to reproduce the problem:

  1. Load any PDF file.
  2. Choose Horizontal Scrolling from Tools menu.

What is the expected behavior? (add screenshot) In Horizontal Scrolling mode, there should be 2 order options for pages: left to right (existing) and right to left (desired). The desired RTL page order is for reading CJK vertical texts. Below shows a correct screenshot: correctOrderRTL

What went wrong? (add screenshot) Currently there is only one order in Horizontal Scrolling: left to right. But for CJK vertical texts, lines are ordered from right to left, i.e., Line k+1 is on the left of Line k, thus Page N+1 should be placed on the left of Page N.

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): N.A.

thesutphin commented 4 years ago

Do you have anymore information on this? I'm thinking of looking more into this. Any info you got would be helpful!

shiyuwang-jamk commented 4 years ago

So the following is the issue I would have come up with, but this issue #11154 is similar so I'll just try to leave my comment here and make things clear.

=============

Title: Add right-to-left rearragement support?

Some books published in Taiwan use right-to-left layout for pages. The feature request is: add a feature where, especially in horizontal scrolling mode, one can read PDFs in a right-to-left order by rearraging the pages.

I do not think that the request have to do with CJK specifically, and did not find the original explanation by @heangfat clear enough. All that is needed is that, when in horizontal mode with the desire RTL option enabled, the pages begin rightmost, and the last page should be on the leftmost side.

All following screenshots of PDF.js version 2.3.164, based on the Chrome extension by @Rob--W , last updated September 13, 2019 (I hope it keeps in pace with the PDF.js releases btw if necessary).

To help with comprehension for those who are not familiar with CJK layout or any East Asian languages, I am going to demostrate using a 4-page PDF with numbers in the pages respectively.

When in regular horizonal scrolling mode, the (normal) page order looks like this:

demo.pdf image

While the desired 'right-to-left' option should look like this if implemented:

This is a seperate PDF file with reversed page order. demo-reverse.pdf image

That is all for the would-be RTL option in horizontal scrolling mode. No need for using PDFs in CJK vertical layout to demostrate IMHO.

And here are some similar options in other mainstream PDF readers:

Foxit reader (version 9.7), 'Reverse View' button in 'View' ribbon:

image

Adobe Acrobat Reader DC (version 2020.012.20043), 'Default Reading Direction' in Edit -> Preferences -> Languages

image

While Foxit acutally 'reversed' all pages, Adobe Acrobat is more natural in terms of reading CJK-based books. But neither of those feature horizontal scrolling like PDF.js does, hence this feature suggestion.