From abd2346e2a563b2b2842e18de333c27c5c8ef0e7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 19 Jan 2021 12:38:04 +0100 Subject: [PATCH 1/2] Put less emphasis on "ES5"/"ES6" in the README and other documentation - Don't explicitly mention "ES5" in https://mozilla.github.io/pdf.js/getting_started/#download, since that's no longer accurate. As-is, this will more than likely give users the wrong impression regarding our *actual* browser support. - Reword the "Getting the Code"-section of the README, since an ES6-compatible browser is no longer sufficient for development purposes given our usage of modern ECMAScript features. - Update the "Building PDF.js"-section of the README, to explicitly mention both the `gulp generic` and `gulp generic-es5` commands. Hopefully this will help reduce *some* user confusion, but we should perhaps also consider changing the "-es5"-suffix in our build-scripts and build-folders. (That would however require coming up with a "better" suffix, which might not be trivial.) --- README.md | 8 ++++++-- docs/contents/getting_started/index.md | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5a93f825c..b954b023f 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ and then you can open: + http://localhost:8888/web/viewer.html -Please keep in mind that this requires an ES6 compatible browser; refer to [Building PDF.js](https://github.com/mozilla/pdf.js/blob/master/README.md#building-pdfjs) for usage with older browsers. +Please keep in mind that this requires a modern and fully up-to-date browser; refer to [Building PDF.js](https://github.com/mozilla/pdf.js/blob/master/README.md#building-pdfjs) for non-development usage of the PDF.js library. It is also possible to view all test PDF files on the right side by opening: @@ -83,7 +83,11 @@ viewer, run: $ gulp generic -This will generate `pdf.js` and `pdf.worker.js` in the `build/generic/build/` directory. +If you need to support older browsers, run: + + $ gulp generic-es5 + +This will generate `pdf.js` and `pdf.worker.js` in the `build/generic/build/` directory (respectively `build/generic-es5/build/`). Both scripts are needed but only `pdf.js` needs to be included since `pdf.worker.js` will be loaded by `pdf.js`. The PDF.js files are large and should be minified for production. diff --git a/docs/contents/getting_started/index.md b/docs/contents/getting_started/index.md index b3328734a..63fcbabe9 100644 --- a/docs/contents/getting_started/index.md +++ b/docs/contents/getting_started/index.md @@ -49,7 +49,7 @@ Before downloading PDF.js please take a moment to understand the different layer
-

Prebuilt (ES5-compatible)

+

Prebuilt (for older browsers)

Includes the generic build of PDF.js and the viewer.

From 5520737798adc9cf32ae6e893324aad3f3376f9e Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 19 Jan 2021 17:41:50 +0100 Subject: [PATCH 2/2] Update the main, and pdfjs-dist, README to also include recent ECMAScript features This adds "optional chaining" and "nullish coalescing" to the list of features needed when using the *modern*, i.e. non-translated/non-polyfilled, build of the PDF.js library. --- README.md | 3 ++- external/dist/README.md | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b954b023f..b97ac63d9 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ Feel free to stop by our [Matrix room](https://chat.mozilla.org/#/room/#pdfjs:mo ### Online demo Please note that the "Modern browsers" version assumes native support for -features such as e.g. `async`/`await`, and `ReadableStream`. +features such as e.g. `async`/`await`, `ReadableStream`, optional chaining, and +nullish coalescing. + Modern browsers: https://mozilla.github.io/pdf.js/web/viewer.html diff --git a/external/dist/README.md b/external/dist/README.md index 6baa2e580..75109c2bb 100644 --- a/external/dist/README.md +++ b/external/dist/README.md @@ -7,7 +7,8 @@ parsing and rendering PDFs. This is a pre-built version of the PDF.js source code. It is automatically generated by the build scripts. -For usage with older browsers/environments, without support for modern features -such as e.g. `async`/`await`, and `ReadableStream`, please see the `es5` folder. +For usage with older browsers or environments, without support for modern +features such as e.g. `async`/`await`, `ReadableStream`, optional chaining, and +nullish coalescing; please see the `es5` folder. See https://github.com/mozilla/pdf.js for learning and contributing.