Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

pdfjs-dist 4.0.379

Generic build of Mozilla's PDF.js library.
Package summary
Share
0
issues
0
licenses
Package created
22 Sep 2014
Version published
31 Dec 2023
Maintainers
3
Total deps
0
Direct deps
0
License
Apache-2.0
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does pdfjs-dist do?

"pdfjs-dist" is a pre-generated build of Mozilla's PDF.js library. It's designed to parse and render Portable Document Format (PDF) files by utilizing the web standards-based platform of HTML5. The goal of this library is to offer a general solution for handling PDFs in various applications. As it's automatically generated, it saves developers the time and effort of creating their own implementation of the PDF.js source code.

How do you use pdfjs-dist?

To use the "pdfjs-dist" npm package, you need to install it first in your project using the command npm install pdfjs-dist. Regarding the implementation, here is a basic usage example:

var pdfjsLib = require('pdfjs-dist');
var pdfPath = 'path_to_your_pdf_file.pdf';

pdfjsLib.getDocument(pdfPath).promise.then(function(doc) {
  var totalPages = doc.numPages;
  console.log('The document has ' + totalPages + ' page(s).');
});

This code essentially loads a PDF document and logs out the number of pages it contains. Note that you need to replace 'path_to_your_pdf_file.pdf' with the actual path of your PDF file.

Where are the pdfjs-dist docs?

The "pdfjs-dist" documentation, as well as useful information for learning and contributing, can be found at the PDF.js GitHub page. Further support for dealing with older browsers/environments and usage of the legacy/ folder is available on the Frequently Asked Questions wiki page.