-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Add CDN links #8980
Add CDN links #8980
Conversation
I'm not sure that we, first of all, should (effectively) endorse a specific CDN in this very visible way!? Edit: Also, does following these instructions work correctly? Considering that there's no mention of the |
That is, of course, completely up to you. Most JS projects do provide a CDN link in their README/documentation because it makes using the code easier (and using a CDN is usually better than serving files from your server). From user's POV, I can say that the getting started page is exactly where I would expect this, in addition to the full zip packages, but I'll be happy to modify this PR if you decide you actually want this somewhere. |
Interestingly enough Mozilla has covered jsDelivr before :) https://hacks.mozilla.org/2014/03/jsdelivr-the-advanced-open-source-public-cdn/ |
What jsDelivr provides that cdnjs or npmcdn does not? Does jsDeliver allow cors to access cmaps? |
Yes, cors is enabled for all resources. |
I tested the https://gist.github.com/yurydelendik/016016dcb126ee5c84b4a9c3cc734d8e example. The CORS at jsDeliver does not work. I tested npmcdn.com it works there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to provide an alternative CDNs and don't want to be exclusive to the jsDelivr. Please rephrase text in neutral language and list available/popular CDNs that host PDF.js at this moment.
README.md
Outdated
@@ -45,6 +45,13 @@ PDF.js is built into version 19+ of Firefox, however, one extension is still ava | |||
Chrome, go to `Tools > Extension` and load the (unpackaged) extension from the | |||
directory `build/chromium`. | |||
|
|||
### Including via a CDN | |||
|
|||
To use PDF.js via a CDN you need to include this file from [jsDelivr](https://www.jsdelivr.com/package/npm/pdfjs-dist): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this section as ##
after the "Building PDF.js"
README.md
Outdated
|
||
To use PDF.js via a CDN you need to include this file from [jsDelivr](https://www.jsdelivr.com/package/npm/pdfjs-dist): | ||
``` | ||
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@1/build/pdf.min.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot exclusively list only jsdelivr, please list npmcdn.com prior jsdelivr.net since some finality (e.g. cmaps) does not work with the former.
@@ -37,6 +37,12 @@ Before downloading PDF.js please take a moment to understand the different layer | |||
|
|||
## Download | |||
|
|||
You can use PDF.js by including this file from [jsDelivr](https://www.jsdelivr.com/package/npm/pdfjs-dist): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the text from the download section, list it in the separate section below.
I think you just used a wrong link there. https://www.jsdelivr.com/ is the website, CDN files are on a different domain (for security and other reasons) - https://cdn.jsdelivr.net/npm/pdfjs-dist/cmaps/ |
Sorry, I just copied what is/was provided at a8d7397#diff-04c6e90faac2675aa89e2176d2eec7d8R50 |
@yurydelendik Let me know if you want to change anything else. |
README.md
Outdated
@@ -88,6 +88,13 @@ This will generate `pdf.js` and `pdf.worker.js` in the `build/generic/build/` di | |||
Both scripts are needed but only `pdf.js` needs to be included since `pdf.worker.js` will | |||
be loaded by `pdf.js`. The PDF.js files are large and should be minified for production. | |||
|
|||
## Including via a CDN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this section after ## Using PDF.js in a web application
?
@LukasDrgon Also, please squash the commits into one commit (see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits) once you made the change requested above. |
Add CDN link Add Popular CDNs Add popular CDNs (site) Moving section
All done 👍 |
Thank you for the patch! |
I added jsDelivr CDN links to your site and readme for easier and faster usage. jsDelivr is the fastest opensource CDN available and built specifically for production usage.