pdf.js/examples/browserify
Jonas Jenwald 4db7330677 Enable ESLint rules that no longer need to be disabled on a directory/file-basis
Given that browsers/environments without native support for both arrow functions and object shorthand properties are no longer supported in PDF.js, please refer to the compatibility information below, we can now enable a fair number of ESLint rules and also simplify/remove some `.eslintrc` files.

With the exception of the `no-alert` cases, all code changes were made automatically by using `gulp lint --fix`.

 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#browser_compatibility
2021-01-22 17:47:03 +01:00
..
.gitignore Initial browserify example. 2016-04-04 11:32:01 -05:00
gulpfile.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
index.html Removing "entry-loader" dependency from webpack. 2016-04-13 08:24:25 -05:00
main.js Enable ESLint rules that no longer need to be disabled on a directory/file-basis 2021-01-22 17:47:03 +01:00
package.json Adds gulp dist-install command; using pdfjs-dist package in examples. 2017-06-12 10:22:16 -05:00
README.md Adds gulp dist-install command; using pdfjs-dist package in examples. 2017-06-12 10:22:16 -05:00
worker.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00

Overview

Example to demonstrate PDF.js library usage with Browserify.

Getting started

Build project and install the example dependencies:

$ gulp dist-install
$ cd examples/browserify
$ npm install

To build Browserify bundles, run gulp build. If you are running a web server, you can observe the build results at http://localhost:8888/examples/browserify/index.html

See main.js, worker.js and gulpfile.js files. Please notice that PDF.js packaging requires packaging of the main application and PDF.js worker code, and the workerSrc path shall be set to the latter file. The pdf.worker.js file shall be excluded from the main bundle.

Alternatives to the gulp commands (without compression) are:

$ mkdir -p ../../build/browserify
$ node_modules/.bin/browserify main.js -u ./node_modules/pdfjs-dist/build/pdf.worker.js -o ../../build/browserify/main.bundle.js
$ node_modules/.bin/browserify worker.js -o ../../build/browserify/pdf.worker.bundle.js