mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Slightly re-factor the transportFactory
initialization in getDocument
Given that the `WorkerTransport`-constructor will access all possible factory-instances, let's ensure that the `transportFactory`-object always has a consistent shape regardless of other options. Also, since `useWorkerFetch` is always true in MOZCENTRAL builds we never need to create `CMapReaderFactory`/`StandardFontDataFactory`-instances there.
This commit is contained in:
parent
a1283785e5
commit
a989244570
1 changed files with 10 additions and 9 deletions
|
@ -341,16 +341,17 @@ function getDocument(src = {}) {
|
|||
const transportFactory = {
|
||||
canvasFactory: new CanvasFactory({ ownerDocument, enableHWA }),
|
||||
filterFactory: new FilterFactory({ docId, ownerDocument }),
|
||||
cMapReaderFactory:
|
||||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
||||
useWorkerFetch
|
||||
? null
|
||||
: new CMapReaderFactory({ baseUrl: cMapUrl, isCompressed: cMapPacked }),
|
||||
standardFontDataFactory:
|
||||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
||||
useWorkerFetch
|
||||
? null
|
||||
: new StandardFontDataFactory({ baseUrl: standardFontDataUrl }),
|
||||
};
|
||||
if (!useWorkerFetch) {
|
||||
transportFactory.cMapReaderFactory = new CMapReaderFactory({
|
||||
baseUrl: cMapUrl,
|
||||
isCompressed: cMapPacked,
|
||||
});
|
||||
transportFactory.standardFontDataFactory = new StandardFontDataFactory({
|
||||
baseUrl: standardFontDataUrl,
|
||||
});
|
||||
}
|
||||
|
||||
if (!worker) {
|
||||
const workerParams = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue