GoogleChromeLabs / link-to-text-fragment

Browser extension that allows for linking to arbitrary text fragments.
https://chrome.google.com/webstore/detail/link-to-text-fragment/pbcodcjpfjdpcineamnnmbkkmkdpajjg
Apache License 2.0
412 stars 33 forks source link

How to make it working with PDF when opened in browser #19

Closed infact closed 4 years ago

infact commented 4 years ago

Did it actually work for pdf file(opened in chromium).? It did not work for me. For HTML files it is working fine. For PDF file opened in chrome/chromium, it will show the context menu to "copy link to selected text" but actually no link is getting copied.

tomayac commented 4 years ago

While PDFs are rendered in a browser tab, they are not webpages, which means the extension cannot run. Unfortunately there is no way to prevent the context menu from appearing. Sorry for this.

carlgieringer commented 1 year ago

Could the extension work with PDFs rendered using PDF.js? I think PDF.js works by translating the PDF into HTML (see screenshot below), and that Firefox opens PDFs using PDF.js by default.

Screenshot 2023-08-10 at 9 24 21 AM

https://www.supremecourt.gov/opinions/22pdf/22-535_i3kn.pdf

tomayac commented 1 year ago

PDF.js in this case is an implementation detail of a specific vendor's PDF viewer, but not generalizable to all vendors. If this use case is essential for you, you can for the extension.