mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +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
|
@ -39,16 +39,21 @@ function renderDocument(pdf, svgLib) {
|
|||
Promise.all([System.import('pdfjs/display/api'),
|
||||
System.import('pdfjs/display/svg'),
|
||||
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], svg = modules[1], global = modules[2], network = modules[3];
|
||||
var api = modules[0];
|
||||
var svg = modules[1];
|
||||
var global = modules[2];
|
||||
var GlobalWorkerOptions = modules[3].GlobalWorkerOptions;
|
||||
var network = modules[4];
|
||||
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[4];
|
||||
GlobalWorkerOptions.workerSrc = modules[5];
|
||||
|
||||
// In production, change this to point to where the cMaps are placed.
|
||||
global.PDFJS.cMapUrl = '../../external/bcmaps/';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue