This is the forked version of PDF.js. NOT the official repo.
If you are looking for the official repo of PDF.js, please visit mozilla/pdf.js.
We publish the distribution files (the viewer) as private npm packages.
Using npm install
with NPM v7 above will upgrade the lockfileVersion
of package-lock.json
and result in a huge package-lock.json
file.
You can use npm ci
instead to install the dependencies: https://docs.npmjs.com/cli/v7/commands/npm-ci
There are several scripts to build the viewer with different setting:
npm run build:generic # For modern browser (Not include iOS Safari)
npm run build:generic-legacy # Support more browsers
npm run build:minified # For modern browser (Not include iOS Safari) and with JS minified
npm run build:minified-legacy # Support more browsers with JS minified
npm run build
will run npm run build:minified-legacy
by default.
Example Output:
build/
└── minified-legacy/
├── build/
│ ├── pdf.js - display layer
│ ├── pdf.js.map - display layer's source map
│ ├── pdf.sandbox.js - secure container for embedded script
│ ├── pdf.sandbox.js.map - secure container's source map
│ ├── pdf.worker.js - core layer
│ └── pdf.worker.js.map - core layer's source map
├── web/
│ ├── cmaps/ - character maps (required by core)
│ ├── images/ - images for the viewer and annotation icons
│ ├── locale/ - translation files
│ ├── standard_fonts/ - basic fonts used for render pdf file without embedded font
│ ├── debugger.js - helpful debugging features
│ ├── viewer.css - viewer style sheet
│ ├── viewer.html - viewer layout
│ ├── viewer.js - viewer layer
│ └── viewer.js.map - viewer layer's source map
└── LICENSE