Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: ship pdf.js CMaps so CJK documents render in the viewer (#14318)

Oskar Okuno9d50a3b261c4
diff --git a/src-ui/angular.json b/src-ui/angular.json
index c3801947d..633be88c5 100644
--- a/src-ui/angular.json
+++ b/src-ui/angular.json
@@ -91,6 +91,11 @@
"glob": "**/*",
"input": "node_modules/pdfjs-dist/iccs/",
"output": "/assets/iccs/"
+ },
+ {
+ "glob": "**/*",
+ "input": "node_modules/pdfjs-dist/cmaps/",
+ "output": "/assets/cmaps/"
}
],
"styles": [
diff --git a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.spec.ts b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.spec.ts
index bb64cee1f..a3f47abae 100644
--- a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.spec.ts
+++ b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.spec.ts
@@ -90,6 +90,7 @@ describe('PngxPdfViewerComponent', () => {
withCredentials: true,
wasmUrl: expect.stringContaining('/paperless/assets/wasm/'),
iccUrl: expect.stringContaining('/paperless/assets/iccs/'),
+ cMapUrl: expect.stringContaining('/paperless/assets/cmaps/'),
})
})
diff --git a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts
index a4a9dbd19..7994e82be 100644
--- a/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts
+++ b/src-ui/src/app/components/common/pdf-viewer/pdf-viewer.component.ts
@@ -190,6 +190,7 @@ export class PngxPdfViewerComponent
withCredentials: true,
wasmUrl: new URL('assets/wasm/', this.document.baseURI).toString(),
iccUrl: new URL('assets/iccs/', this.document.baseURI).toString(),
+ cMapUrl: new URL('assets/cmaps/', this.document.baseURI).toString(),
}
this.loadingTask = getDocument(initOptions)
try {