Created
May 23, 2017 13:23
-
-
Save MEGApixel23/caa33a5a40cd0ac6f2c09473db75e658 to your computer and use it in GitHub Desktop.
Getting number of pages in PDF file from remote source. PDFJS is used http://mozilla.github.io/pdf.js/getting_started/#download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fileLink = 'https://link-to-remote-file.pdf'; | |
PDFJS.workerSrc = '/path/to/pdf.worker.js'; | |
PDFJS.getDocument(fileLink) | |
.then(function (doc) { | |
// A lots of valuable information in `doc` variable | |
return doc.pdfInfo.numPages; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment