Skip to content

Commit f4c6fff

Browse files
Merge pull request #20865 from Snuffleupagus/internal-viewer-urls
Bundle the necessary files and set the correct `cMapUrl`, `iccUrl`, and `standardFontDataUrl` when building `gulp internal-viewer`
2 parents a7083d0 + 75739a1 commit f4c6fff

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

gulpfile.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,6 +2403,9 @@ function buildInternalViewer(defines, dir) {
24032403
])
24042404
)
24052405
.pipe(gulp.dest(dir + "web")),
2406+
createCMapBundle().pipe(gulp.dest(dir + "web/cmaps")),
2407+
createICCBundle().pipe(gulp.dest(dir + "web/iccs")),
2408+
createStandardFontBundle().pipe(gulp.dest(dir + "web/standard_fonts")),
24062409
createWasmBundle().pipe(gulp.dest(dir + "web/wasm")),
24072410
]);
24082411
}

web/pdf_internal_viewer.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,15 @@ async function openDocument(source, name) {
851851

852852
const loadingTask = getDocument({
853853
...source,
854-
cMapUrl: "../external/bcmaps/",
854+
cMapUrl:
855+
typeof PDFJSDev === "undefined" ? "../external/bcmaps/" : "../web/cmaps/",
856+
iccUrl:
857+
typeof PDFJSDev === "undefined" ? "../external/iccs/" : "../web/iccs/",
858+
standardFontDataUrl:
859+
typeof PDFJSDev === "undefined"
860+
? "../external/standard_fonts/"
861+
: "../web/standard_fonts/",
855862
wasmUrl: "../web/wasm/",
856-
iccUrl: "../external/iccs/",
857-
standardFontDataUrl: "../external/standard_fonts/",
858863
useWorkerFetch: true,
859864
pdfBug: true,
860865
CanvasFactory: DebugCanvasFactory,

0 commit comments

Comments
 (0)