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

Load PDF.js library from CDN #19

Merged
merged 4 commits into from
Mar 15, 2023
Merged

Load PDF.js library from CDN #19

merged 4 commits into from
Mar 15, 2023

Conversation

ericswpark
Copy link
Contributor

@ericswpark ericswpark commented Jul 2, 2021

Closes #18
Closes #2

@ericswpark
Copy link
Contributor Author

@anvithks here's the requested PR :)

Copy link
Owner

@anvithks anvithks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericswpark thanks for this PR. As you pointed out reverting the previous commit is needed to test it locally. I was able to test this but I feel removing the local files support may not work out for everyone.
I would like to explore the option of making this configurable and allowing the user to use either the CDN or local install.
Let me know if you could help out with this.

@ericswpark
Copy link
Contributor Author

@ericswpark thanks for this PR. As you pointed out reverting the previous commit is needed to test it locally. I was able to test this but I feel removing the local files support may not work out for everyone.
I would like to explore the option of making this configurable and allowing the user to use either the CDN or local install.
Let me know if you could help out with this.

I understand but unfortunately I do not have the time right now. I'll close the PR but feel free to base changes off of this PR.

@ericswpark ericswpark closed this Aug 28, 2021
@anvithks
Copy link
Owner

@ericswpark thanks for this PR. As you pointed out reverting the previous commit is needed to test it locally. I was able to test this but I feel removing the local files support may not work out for everyone.
I would like to explore the option of making this configurable and allowing the user to use either the CDN or local install.
Let me know if you could help out with this.

I understand but unfortunately I do not have the time right now. I'll close the PR but feel free to base changes off of this PR.

Sorry about that.
I will cherrypick from this PR when I get it working.
Thank you for the contribution.

@anvithks anvithks reopened this Aug 29, 2021
@anvithks
Copy link
Owner

@ericswpark I spent some time over the weekend on the shortcode and tested all the PRs.
With the baseURL changes added in 704485b, using the relURL or Site.baseURL results in CORS errors.

This is mentioned in the embed-pdf.html file as part of the pdf.js inline comments

// If absolute URL from the remote server is provided, configure the CORS
// header on that server.

In this case the CDN comes in handy.

I would like to merge this PR but it removes the static library.

Ideally I would like the users to have the option of either installing via CDN or static library.

Would it be possible for you to just remove the commits wherein the static library has been removed.
I will then update the docs to let the users use the appropriate script source.

It could default to the CDN and if there is a requirement to keep it local then they can follow the alternate installation steps.

Please let me know your thoughts.

@ericswpark
Copy link
Contributor Author

@anvithks I've dropped the commits that remove the library.

@sonarcloud
Copy link

sonarcloud bot commented May 19, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@chtzvt chtzvt mentioned this pull request Jun 9, 2022
@sonarcloud
Copy link

sonarcloud bot commented Mar 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Owner

@anvithks anvithks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Tested this and it seems to work with the latest PDF.js version as well.
Need to add the following comment to embed-pdf.html for those who wish to use local version of files.

<!-- If using the baseURL then use this src= '{{"/" | relURL}}js/pdf-js/build/pdf.js'  -->

@anvithks anvithks merged commit b882387 into anvithks:master Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PDF.js library loading broken Use CDN instead of including the library files
3 participants