426945b480
Please note that these changes were done automatically, using `gulp lint --fix`. Given that the major version number was increased, there's a fair number of (primarily whitespace) changes; please see https://prettier.io/blog/2020/03/21/2.0.0.html In order to reduce the size of these changes somewhat, this patch maintains the old "arrowParens" style for now (once mozilla-central updates Prettier we can simply choose the same formatting, assuming it will differ here). |
||
---|---|---|
.. | ||
.eslintrc | ||
.gitignore | ||
index.html | ||
main.js | ||
package.json | ||
README.md | ||
webpack.config.js |
Overview
Example to demonstrate PDF.js library usage with Webpack.
Getting started
Install the example dependencies and build the project:
$ gulp dist-install
$ cd examples/webpack
$ npm install
$ ./node_modules/webpack/bin/webpack.js
You can observe the build results by running gulp server
and navigating to
http://localhost:8888/examples/webpack/index.html.
Refer to the main.js
and webpack.config.js
files for the source code.
Note that PDF.js packaging requires packaging of the main application and
the worker code, and the workerSrc
path shall be set to the latter file.
Worker loading
If you are getting the Setting up fake worker
warning, make sure you are importing pdfjs-dist/webpack
which is the zero-configuration method for Webpack users:
import pdfjsLib from 'pdfjs-dist/webpack';
For a full working example refer to this repository.