Skip to content

Commit

Permalink
Merge pull request #18785 from Snuffleupagus/transportFactory-init
Browse files Browse the repository at this point in the history
Slightly re-factor the `transportFactory` initialization in `getDocument`
  • Loading branch information
Snuffleupagus authored Sep 26, 2024
2 parents 2ff8035 + a989244 commit 3902a14
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 3902a14

Please sign in to comment.