Skip to content
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

Read PDFs from URL option #25

Closed
jzillmann opened this issue Mar 6, 2021 · 12 comments
Closed

Read PDFs from URL option #25

jzillmann opened this issue Mar 6, 2021 · 12 comments

Comments

@jzillmann
Copy link
Owner

Currently we can :

  1. drop or browse PDFs
  2. Open the Example.pdf

Would be nice to have a 3rd option where one can enter a URL.

PDF.js already can source from a URL (we're doing it for (2) already), so this should be purely UI.

@jzillmann jzillmann added this to the v2 milestone Mar 6, 2021
@jzillmann jzillmann changed the title Read pdfs from URL option Read PDFs from URL option Mar 6, 2021
@jzillmann jzillmann assigned jzillmann and unassigned jzillmann Mar 28, 2021
@darkcheftar
Copy link

Sire, @jzillmann I love contributing to this issue. But I haven't made any contribution to any repository till now, But I'm keen to learn. Could you please be able to help me out a little?
Regards @darkcheftar.

@jzillmann
Copy link
Owner Author

Hey @darkcheftar,

great!
Process wise I would expect you to open a pull request for this particular issue. Let me know if you need more guidance there.
Code wise the interesting places are:

  • ui/src/store.ts (the function parsePdf(src: string already takes an URL)
  • ui/src/main/Upload.svelte
    • In the Options section next Load Example I envision a Open URL link
    • Maybe pressing that links opens a popup with a text field to enter the link and enter/ok button to submit
    • If you can get this simple version to work, we can also discuss about something more sophisticated!

@darkcheftar
Copy link

Thank you, Sire @jzillmann I will check into it and let you know what I'm up to soon!

@darkcheftar
Copy link

darkcheftar commented Mar 31, 2021

Sire @jzillmann In solving #25 issue in order to test proof of concept that on passing a URL to parsePdf function it loads pdf. I replaced 'Example.pdf' with This URL as shown below. And Clicked the option load Example.

export async function loadExample(progressListener: ProgressListenFunction): Promise<any> {
-    return parsePdf('ExamplePdf.pdf', progressListener);
+   return parsePdf('https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf', progressListener);
}

I got the following error.
image

please help me with this.

@jzillmann
Copy link
Owner Author

Ok, so the CORS thingy... 😞
Guess this is kind of expected, see also https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr

Not sure but I guess the only reliable way to enable this feature is to use a proxy. See mozilla/pdf.js#1000 (comment)
Can you try that ?

@darkcheftar
Copy link

Sure, I will definitely try checking this😄. Thanks for the support.

@darkcheftar
Copy link

sire @jzillmann please check #27 I tried to fix #25 Let me know if there are any suggestions or changes.
🤗

@jzillmann
Copy link
Owner Author

Thanks @darkcheftar looks good, added some minor comments on the PR!
Also I apologize for the setup mess. When checking out your fork I recognized a lot of inconveniences (error in Visual Code, missing dependencies. etc...)...
My plan was to to a project setup cleanup near completion to the modularization (i.e. core should be a published NPM module), but I guess it meaningful to keep things a bit more straighter until then! So let me know if something isn't working for you with the initial setup!

@darkcheftar
Copy link

Thanks, sire @jzillmann. I hope you are safe and sound.
I will try to answer those minor comments as soon as possible. 😃

@darkcheftar
Copy link

darkcheftar commented Apr 9, 2021

Thanks @darkcheftar looks good, added some minor comments on the PR!
Also I apologize for the setup mess. When checking out your fork I recognized a lot of inconveniences (error in Visual Code, missing dependencies. etc...)...
My plan was to to a project setup cleanup near completion to the modularization (i.e. core should be a published NPM module), but I guess it meaningful to keep things a bit more straighter until then! So let me know if something isn't working for you with the initial setup!

Got it, Sire!
While bringing a great change we need to go through a bit of suffering.

@jzillmann
Copy link
Owner Author

Changes are in, big thanks! 👏😃

@darkcheftar
Copy link

Hey @jzillmann,
As You I used Heroku for this feature.
and as we know they revoked free tier.
This feature needs some attention again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants