Skip to content

Commit 3da7b8e

Browse files
committed
Fix: Add cMap support for PDF.js
1 parent f75a148 commit 3da7b8e

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
"node_modules/pdfjs-dist/build/pdf.worker.mjs",
153153
"node_modules/pdfjs-dist/image_decoders/pdf.image_decoders.mjs",
154154
"node_modules/pdfjs-dist/wasm",
155+
"node_modules/pdfjs-dist/cmaps",
155156
"images/icon-border-transparent.png",
156157
"images/logo.png",
157158
"images/logo.svg",

scripts/file-manager.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,8 @@ var fileCompressed = function(path, _realPath = false, forceType = false, prefix
22832283
this.pdf = await unpdf.getDocument({
22842284
url: encodeURIComponent(this.realPath).replace(/\%2F/g,'/').replace(/\%5C/g,'\\').replace(/\%3A/g, ':'),
22852285
wasmUrl: fileManager.posixPath(asarToAsarUnpacked(p.join(appDir, 'node_modules/pdfjs-dist/wasm/'))),
2286+
cMapUrl: fileManager.posixPath(asarToAsarUnpacked(p.join(appDir, 'node_modules/pdfjs-dist/cmaps/'))),
2287+
cMapPacked: true,
22862288
/*nativeImageDecoderSupport: 'none', disableFontFace: true*/
22872289
}).promise;
22882290

0 commit comments

Comments
 (0)