[Pkg-javascript-commits] [pdf.js] 131/174: Fixes all examples to require workerSrc to be set.
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:45:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 601d29b14e52b6ca3a9efe9596c038c6b39abe6d
Author: Yury Delendik <ydelendik at mozilla.com>
Date: Fri Nov 6 07:39:13 2015 -0600
Fixes all examples to require workerSrc to be set.
---
examples/components/pageviewer.js | 6 ++----
examples/components/simpleviewer.js | 6 ++----
examples/learning/helloworld.html | 6 ++----
examples/learning/helloworld64.html | 7 +++----
examples/text-only/pdf2svg.js | 2 ++
src/display/api.js | 4 +++-
6 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/examples/components/pageviewer.js b/examples/components/pageviewer.js
index 41c1b35..c36e375 100644
--- a/examples/components/pageviewer.js
+++ b/examples/components/pageviewer.js
@@ -20,11 +20,9 @@ if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
' `node make generic components`');
}
-// In cases when the pdf.worker.js is located at the different folder than the
-// pdf.js's one, or the pdf.js is executed via eval(), the workerSrc property
-// shall be specified.
+// The workerSrc property shall be specified.
//
-// PDFJS.workerSrc = '../../build/pdf.worker.js';
+PDFJS.workerSrc = '../../build/pdf.worker.js';
// Some PDFs need external cmaps.
//
diff --git a/examples/components/simpleviewer.js b/examples/components/simpleviewer.js
index db8256f..fe2276f 100644
--- a/examples/components/simpleviewer.js
+++ b/examples/components/simpleviewer.js
@@ -20,11 +20,9 @@ if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
' `node make generic components`');
}
-// In cases when the pdf.worker.js is located at the different folder than the
-// pdf.js's one, or the pdf.js is executed via eval(), the workerSrc property
-// shall be specified.
+// The workerSrc property shall be specified.
//
-// PDFJS.workerSrc = '../../build/pdf.worker.js';
+PDFJS.workerSrc = '../../build/pdf.worker.js';
// Some PDFs need external cmaps.
//
diff --git a/examples/learning/helloworld.html b/examples/learning/helloworld.html
index 347dbbe..564c2ce 100644
--- a/examples/learning/helloworld.html
+++ b/examples/learning/helloworld.html
@@ -30,11 +30,9 @@
// PDFJS.disableWorker = true;
//
- // In cases when the pdf.worker.js is located at the different folder than the
- // pdf.js's one, or the pdf.js is executed via eval(), the workerSrc property
- // shall be specified.
+ // The workerSrc property shall be specified.
//
- // PDFJS.workerSrc = '../../build/pdf.worker.js';
+ PDFJS.workerSrc = '../../build/pdf.worker.js';
//
// Asynchronous download PDF
diff --git a/examples/learning/helloworld64.html b/examples/learning/helloworld64.html
index 06333aa..ea11ef9 100644
--- a/examples/learning/helloworld64.html
+++ b/examples/learning/helloworld64.html
@@ -40,11 +40,10 @@
//
// PDFJS.disableWorker = true;
- // In cases when the pdf.worker.js is located at the different folder than the
- // pdf.js's one, or the pdf.js is executed via eval(), the workerSrc property
- // shall be specified.
//
- // PDFJS.workerSrc = '../../build/pdf.worker.js';
+ // The workerSrc property shall be specified.
+ //
+ PDFJS.workerSrc = '../../build/pdf.worker.js';
// Opening PDF by passing its binary data as a string. It is still preferable
// to use Uint8Array, but string or array-like structure will work too.
diff --git a/examples/text-only/pdf2svg.js b/examples/text-only/pdf2svg.js
index eb81539..effaf2d 100644
--- a/examples/text-only/pdf2svg.js
+++ b/examples/text-only/pdf2svg.js
@@ -18,6 +18,8 @@ var PAGE_NUMBER = 1;
var PAGE_SCALE = 1.5;
var SVG_NS = 'http://www.w3.org/2000/svg';
+PDFJS.workerSrc = '../../build/pdf.worker.js';
+
function buildSVG(viewport, textContent) {
// Building SVG with size of the viewport (for simplicity)
var svg = document.createElementNS(SVG_NS, 'svg:svg');
diff --git a/src/display/api.js b/src/display/api.js
index fb961d5..8ff3992 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -75,7 +75,9 @@ PDFJS.disableWorker = (PDFJS.disableWorker === undefined ?
/**
* Path and filename of the worker file. Required when the worker is enabled in
* development mode. If unspecified in the production build, the worker will be
- * loaded based on the location of the pdf.js file.
+ * loaded based on the location of the pdf.js file. It is recommended that
+ * the workerSrc is set in a custom application to prevent issues caused by
+ * third-party frameworks and libraries.
* @var {string}
*/
PDFJS.workerSrc = (PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list