question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

missing support for "viewrect" parameter in URL fragment identifiers

See original GitHub issue

According 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:

Steps to reproduce the problem:

  1. Check out the repository, run npm install and gulp 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).
  2. 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:open
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
timvandermeijcommented, Nov 10, 2019

Feel free to work on this. I think wd is “width” and ht is “height”.

1reaction
AndrewMyintcommented, Nov 10, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Putting a fragment identifier inside of a query parameter
You should always encode URL parameter values properly, using a function like encodeURIComponent : window.location.href = "/gauth?next=" + ...
Read more >
6 Things You Should Know About Fragment URLs
To overcome this problem Google supports a convention that allows the Googlebot to turn fragment identifiers into query string parameters. To ...
Read more >
PI34548;8.5.5: URL fragments may be removed when ... - IBM
URL fragments may be removed on requests directed to the SAML web SSO TAI. ... the parameters from the request will be lost...
Read more >
How Google Deals With URL Parameters - SEO Best Practices
Parameter rules set in the tool can also help Google to make decisions on which canonical ... Replace Unnecessary URL Parameters with Fragment...
Read more >
Document URL is missing DocID query string parameter ...
Select the document item in a list view. Select FILES in the top ribbon menu, and then select View Properties. On the details...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found