Updated Setup PDF.js in a website (markdown)

Tim van der Meij 2021-02-10 00:13:34 +01:00
parent c78190f521
commit 4a3493aaff

@ -35,22 +35,5 @@ To use the library in your project add `require('pdfjs-dist')` to your file requ
Refer to https://github.com/mozilla/pdf.js/tree/master/examples/browserify for a complete example.
### Examples
When the source code of PDF.js changes, the [online demo](http://mozilla.github.io/pdf.js/web/viewer.html) is automatically updated. The source of all demo files can easily be accessed at https://github.com/mozilla/pdf.js/tree/gh-pages. These files can also be uploaded to your server to use PDF.js to display PDF files from your website.
1. Download https://github.com/mozilla/pdf.js/archive/gh-pages.zip.
2. Extract the ZIP file (a directory called "pdf.js-gh-pages" will be created).
3. Copy the following directories to your website:
* pdf.js-gh-pages/build/
* pdf.js-gh-pages/web/
The web/ directory contains a 1 MB PDF file called "compressed.tracemonkey-pldi-09.pdf". This file is only used as an example for the demo and can safely be removed.
4. If you want to open a PDF from your website with PDF.js, simply link to the viewer and pass the location of the PDF file. For example:
```html
<a href="/web/viewer.html?file=%2Fyourpdf.pdf">Open yourpdf.pdf with PDF.js</a>
```
Similar to the official releases, we ask you to re-skin it or build upon it before deploying it.
## Build PDF.js from source
After cloning PDF.js, you can build PDF.js from source by running the `gulp generic` command. This will create the built PDF.js in the `build` folder.