mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Move the workerSrc
option from the global PDFJS
object and into GlobalWorkerOptions
instead
This commit is contained in:
parent
45adf33187
commit
c3c1fc511d
20 changed files with 69 additions and 60 deletions
|
@ -2,17 +2,19 @@
|
|||
|
||||
// In production, the bundled pdf.js shall be used instead of SystemJS.
|
||||
Promise.all([System.import('pdfjs/display/api'),
|
||||
System.import('pdfjs/display/global'),
|
||||
System.import('pdfjs/display/worker_options'),
|
||||
System.import('pdfjs/display/network'),
|
||||
System.resolve('pdfjs/worker_loader')])
|
||||
.then(function (modules) {
|
||||
var api = modules[0], global = modules[1], network = modules[2];
|
||||
var api = modules[0];
|
||||
var GlobalWorkerOptions = modules[1].GlobalWorkerOptions;
|
||||
var network = modules[2];
|
||||
api.setPDFNetworkStreamFactory((params) => {
|
||||
return new network.PDFNetworkStream(params);
|
||||
});
|
||||
|
||||
// In production, change this to point to the built `pdf.worker.js` file.
|
||||
global.PDFJS.workerSrc = modules[3];
|
||||
GlobalWorkerOptions.workerSrc = modules[3];
|
||||
|
||||
// Fetch the PDF document from the URL using promises.
|
||||
api.getDocument('helloworld.pdf').then(function (pdf) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue