-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose fragment IDs in the URL #5258
Comments
As far as internal "links" in PDF files goes, you can just right-click them and easily copy the entire URL (the same applies for items in the "Document Outline"). If you want to get the current position in the document, for easy linking, there is a "Current view (...)"-button on the right-hand side of the toolbar. |
@Snuffleupagus thanks for the tips! Is there any reason, though, not to expose them in the location bar? It's equivalent to what's happening in the JS, just not exposed in the browser UI. I'm also only thinking post-link-click exposure--not "as the page scrolls" exposure. Essentially anything that currently adds to the browsing history should look like it did in the location bar. Thanks! |
I think that it's connected with the fact that "links" in PDF files doesn't work the same way as links on e.g. the web. "Links" in PDF files are really
That's good! Because updating the history on every scroll event would probably be really bad for performance. |
@Snuffleupagus thanks for the detailed reply!
However, I did some more digging and found RFC3778 Section 3 which defines Fragment Identifiers for the It links to an Adobe technical note, Parameters for Opening PDF Files. In which is a Specifying parameters in a URL and a list of available parameters. It does, however, drive off the map a bit and say that either Would be great to see them all added, but for now Thanks for digging into this issue @Snuffleupagus! |
Given that an average user most likely doesn't care if a "link" is of the |
Agreed. If it updates the navigation history, the URL should change. The fragment identifier should match what's been specified in the PDF docs. Guess I was just after some of this sooner than later. 😉 Good call, though. |
I proposed to place a |
@andrenarchy As explained in #5258 (comment), HTML links are not identical to the destinations used in PDF files. Finally, in PDF.js we only render the currently visible pages, for performance and memory reasons. If your suggestion was implemented, that would mean that links wouldn't work unless the page had already been rendered. |
Thx @Snuffleupagus for your explanation! Now I understand why my proposal isn't a good idea. I'll try to see why links don't work in my viewer-based application. Probably only the scrolling part doesn't work... |
@timvandermeij Let's just close this as a duplicate of #5753, since these issues are similar enough and the (optional) functionality from PR #10423 is the only thing we could/should do here. |
PDF.js uses fragment IDs for navigating within a PDF, but those fragment IDs are not exposed to the URL / browsing history. However, they are usable directly from the location bar and even work with the PDF viewer included in Chrome 36 (with the exclusion of
page=123
).Having these in the browsing history would mean that one could easily create links into specific sections of a PDF.
Here are some example URL's pulled from the source code--which I'd much have preferred to crib from the location bar. 😸
PDF section identifier-based fragment ID (afaik):
http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf#G13.1696671
PDF.js "proprietary"
?page=#
style URL:http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf#page=607
Thanks for consider this idea! 💡
The text was updated successfully, but these errors were encountered: