From 050331840a896829ce67bf97b8ff635186fdc585 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Wed, 27 Nov 2019 23:25:20 +0100 Subject: [PATCH] Updated Setup PDF.js in a website (markdown) --- Setup-PDF.js-in-a-website.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Setup-PDF.js-in-a-website.md b/Setup-PDF.js-in-a-website.md index 9639930..9862f06 100644 --- a/Setup-PDF.js-in-a-website.md +++ b/Setup-PDF.js-in-a-website.md @@ -1,17 +1,21 @@ You can choose to use a pre-built version of PDF.js or build PDF.js from source. ## Pre-built PDF.js -### With npm +### Official releases -Add the dependencies to your project: +The official releases from https://github.com/mozilla/pdf.js/releases include the generic build of PDF.js and the viewer. This is most likely the best choice if you're not aiming to build your own viewer. The viewer is built on the display layer and is the UI for PDF viewer in Firefox and the other browser extensions within the project. It can be a good starting point for building your own viewer. However, we do ask if you plan to embed the viewer in your own site, that it not just be an unmodified version. Please re-skin it or build upon it. + +### NPM + +Install the PDF.js dependency in your project: npm install pdfjs-dist --save You can find a usage example at https://github.com/mozilla/pdf.js/blob/master/examples/node/getinfo.js. -#### With Webpack +#### Webpack -Add the dependencies to your project: +Install the PDF.js dependency in your project: npm install pdfjs-dist --save-dev @@ -19,9 +23,9 @@ 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/webpack for a complete example. -#### With Browserify +#### Browserify -Add the dependencies to your project: +Install the PDF.js dependency in your project: npm install pdfjs-dist --save-dev @@ -29,7 +33,7 @@ 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. -### From examples +### 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. @@ -44,7 +48,7 @@ When the source code of PDF.js changes, the [online demo](http://mozilla.github. Open yourpdf.pdf with PDF.js ``` -The viewer is built on the display layer and is the UI for PDF viewer in Firefox and the other browser extensions within the project. It can be a good starting point for building your own viewer. *However, we do ask if you plan to embed the viewer in your own site, that it not just be an unmodified version. Please re-skin it or build upon it.* +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 `gulp generic` in Git Bash or another terminal. This will create the built PDF.js in the `build` folder, which you can upload to your server. \ No newline at end of file +After cloning PDF.js, you can build PDF.js from source by running the `gulp generic` coomand. This will create the built PDF.js in the `build` folder. \ No newline at end of file