pdf.js/examples/webpack/README.md

28 lines
947 B
Markdown
Raw Normal View History

## Overview
Example to demonstrate PDF.js library usage with Webpack.
## Getting started
2018-05-20 22:18:43 +09:00
Install the example dependencies and build the project:
$ gulp dist-install
$ cd examples/webpack
$ npm install
2018-05-20 22:18:43 +09:00
$ ./node_modules/webpack/bin/webpack.js
2018-05-20 22:18:43 +09:00
You can observe the build results by running `gulp server` and navigating to
http://localhost:8888/examples/webpack/index.html.
2018-05-20 22:18:43 +09:00
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](https://github.com/yurydelendik/pdfjs-react).