Skip to content

Instantly share code, notes, and snippets.

@MEGApixel23
Created May 23, 2017 13:23
Show Gist options
  • Save MEGApixel23/caa33a5a40cd0ac6f2c09473db75e658 to your computer and use it in GitHub Desktop.
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
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