cdnjs
cdnjs.com › home › libraries › pdf.js › 2.6.347
pdf.js - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
Content delivery at its finest. cdnjs is a free and open-source CDN service trusted by over 12.5% of all websites, serving over 200 billion requests each month, powered by Cloudflare.
Mozilla
mozilla.github.io › pdf.js
PDF.js - Home
A general-purpose, web standards-based platform for parsing and rendering PDFs.
Videos
Top answer 1 of 3
4
You have to set GlobalWorkerOptions.workerSrc to /build/pdf.worker(.min).js of same version:
pdfjsLib.GlobalWorkerOptions.workerSrc =
"https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.min.js";
pdfjsLib.getDocument('./ahmed.pdf').promise.then(doc => {
console.log(`This document has ${doc._pdfInfo.numPages} pages.");
});
And, as @Pasi has mentioned, you have to promisify .getDocument() by chaining .promise on it. Without it, there is no .then().
2 of 3
1
See the "Hello World with document load error handling" example on this page to get started: https://mozilla.github.io/pdf.js/examples/
(Your snippet is missing .promise after getDocument() and setting the workerSrc property)
jsDelivr
jsdelivr.com › package › npm › pdfjs-dist
pdfjs-dist CDN by jsDelivr - A CDN for npm and GitHub
September 22, 2014 - A free, fast, and reliable CDN for pdfjs-dist. Generic build of Mozilla's PDF.js library.
Published Sep 22, 2014
Repository https://github.com/mozilla/pdf.js
Mozilla
mozilla.github.io › pdf.js › getting_started
PDF.js - Getting Started
PDF.js is hosted on several free CDNs: https://www.jsdelivr.com/package/npm/pdfjs-dist · https://cdnjs.com/libraries/pdf.js · https://unpkg.com/pdfjs-dist/ Note that we only mention the most relevant files and folders.
jsDelivr
cdn.jsdelivr.net › build
pdfjs-dist CDN by jsDelivr - A free, fast, and reliable Open Source CDN
Free Open Source CDN for pdfjs-dist · Looking for a nice landing page for your package? https://www.jsdelivr.com/package/npm/pdfjs-dist
GitHub
github.com › mozilla › pdf.js
GitHub - mozilla/pdf.js: PDF Reader in JavaScript
The PDF.js files are large and should be minified for production. To use PDF.js in a web application you can choose to use a pre-built version of the library or to build it from source. We supply pre-built versions for usage with NPM under the pdfjs-dist name.
Starred by 52.4K users
Forked by 10.5K users
Languages JavaScript 71.3% | Fluent 25.5% | CSS 2.2%
PDF-LIB
pdf-lib.js.org
PDF-LIB · Create and modify PDF documents in any ...
https://cdn.jsdelivr.net/npm/[email protected]/dist/pdf-lib.min.js
jsDelivr
jsdelivr.com › package › npm › pdf.worker
pdf.worker CDN by jsDelivr - A CDN for npm and GitHub
October 10, 2023 - A free, fast, and reliable CDN for pdf.worker. This is a required file for pdf js to work
Published Oct 10, 2023
GitHub
github.com › mozilla › pdf.js › discussions › 17642
Using CDN links in "demo" `web/viewer.html` · mozilla/pdf.js · Discussion #17642
Short answer: The library is on CDN's and the demo is not. Long answer: There are two versions of pdf.js.
Author mozilla
UNPKG
unpkg.com › pdfjs-dist
pdfjs-dist
The CDN for everything on npm
jsDelivr
jsdelivr.com › package › npm › pdfjs-lib
pdfjs-lib CDN by jsDelivr - A CDN for npm and GitHub
January 12, 2023 - A free, fast, and reliable CDN for pdfjs-lib. Generic build of Mozilla's PDF.js library.
Published Jan 12, 2023
Repository https://github.com/mozilla/pdfjs-dist
CDNPKG
cdnpkg.com › home › pdf.js
PDF.JS CDN links [mozilla/pdf.js] - CDNPKG
1 CDN to use with PDF.JS (mozilla/pdf.js) . Find out the best CDN to use with pdf.js or use multiple CDN as fallback. Simply copy and paste one of these URL !.
PDF.js Express
pdfjs.community › technical support
Is there any CDN url for PDFJS express library - Technical Support - PDF.js Express
June 1, 2021 - Hi Team, We are giving the web-viewer folder library path for rendering the pdf. In local it is working. But in our server we are getting path issue. In our angular project we are using only main.js. Do you have CDN url for the library so that we don’t want to store the lib folder in our project and our path issue will be solved.