missing support for "viewrect" parameter in URL fragment identifiers
See original GitHub issueAccording to Parameters for Opening PDF Files (version 9.0) (and referenced in RFC 8118):
viewrect=left,top,wd,ht
Sets the view rectangle using float or integer values in a coordinate system where 0,0 represents the top left corner of the visible page, regardless of document rotation.
It appears that the viewrect
parameter in PDF URL fragment identifiers is currently unsupported. To verify, I tested as follows:
Configuration:
- Web browser and its version: Firefox Quantum 66.0.3 (64-bit)
- Operating system and its version: GNU/Linux x86_64
- PDF.js version: https://github.com/mozilla/pdf.js/tree/762c58e0fcfdc8f3fd23ce22a15ee044d8d372ec
- Is a browser extension: no
Steps to reproduce the problem:
- Check out the repository, run
npm install
andgulp server
, then navigate the viewer to a PDF with page dimensions of 8.5" x 11" (e.g. http://localhost:8888/web/viewer.html?file=%2Ftest%2Fpdfs%2Ftracemonkey.pdf). - Append
#page=1&viewrect=72,72,288,432
to the URL in the address bar, and reload the page.
What is the expected behavior?
The viewer should zoom into a (roughly) 4" x 6" rectangle that is offset 1" from the top and 1" from the left edge of the page.
What went wrong?
The viewport was not transformed as expected because PDF JS does not support viewrect
.
I also ran
$ git grep viewrect
which yielded 0 results, and did the following searches on GitHub, which both returned nothing:
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
Feel free to work on this. I think
wd
is “width” andht
is “height”.Hi, I am new here, looking for an issue to fix, and I would like to fix this issue unless someone’s already doing it. And I also read the documentation about viewRect, I am not quite sure, what does wd and ht is referring to. Can anybody enlighten me about that wd, and ht, please? Thanks in advance.