Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature request: The ability to load PDFs directly into doqment by URL? #17

Closed
MagicalDrizzle opened this issue Aug 19, 2024 · 3 comments
Labels
question Further information is requested

Comments

@MagicalDrizzle
Copy link

MagicalDrizzle commented Aug 19, 2024

Like you would open the extension's new tab and would be able to insert an external PDF's URL into a text field option to load it, for example.
Apparently it's not easy to do it in vanilla pdf.js because of cross origin security stuffs - and public builds of pdf.js simply doesn't allow it.
I looked further and found a couple of interesting links: A self-hostable proxy to use CORS to bypass the restriction, and the source repo.

I'm curious since you have forked pdf.js, that if this feature request is now possible.

@shivaprsd
Copy link
Owner

shivaprsd commented Aug 20, 2024

@MagicalDrizzle Interesting. First of all, can you tell me your use case? Because if you just paste the URL directly in the address bar and press enter, it would open in doqment if it's a PDF (I'm assuming you are on Firefox).

doqment already does cross-origin all the time. I just pass the URL of the PDF to the PDF.js viewer. Then, the PDF.js script hosted on the extension's origin (which is https://<extension-id>/) loads the PDF located on any random origin. Apparently, extensions are allowed to do this, because I don't do anything particular to make this happen.

Technically, I haven't forked PDF.js; I just take their public build and make a few changes needed.

@shivaprsd shivaprsd added the question Further information is requested label Aug 20, 2024
@MagicalDrizzle
Copy link
Author

I'm actually on Chromium-based in Android, which sadly does not have a embedded PDF viewer (so when you click a pdf it just downloads) and I'm trying to work around that with pdf.js (get a pdf link and load it in browser)
Actually I'm not sure why I asked this here, Brave Android doesn't actually support extensions haha...

@shivaprsd
Copy link
Owner

Yes, that's sad unfortunately. But the time when Google will allow extensions for Chromium on Android is quite far..

If you must, Firefox for Android does support extensions, and doqment works more or less well on it. But that's not actually a "solution"..

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants