From a7a8d83eb0ab5d8a272232c4c89cc18e45065df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 21 Jun 2019 14:02:46 +0200 Subject: [PATCH] Fix load of character maps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The character maps are used by PDF.JS for font rendering, and are needed to properly show some texts (for example, Japanese text). The PDF.JS package provides the needed character maps, but the URL to get them must be set with the "PDFJS.cMapUrl" property in the same way as the "PDFJs.workerSrc" property is set (as the default value set in "viewer.js" is not right for the PDF viewer app). Signed-off-by: Daniel Calviño Sánchez --- js/workersrc.js | 1 + templates/viewer.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/js/workersrc.js b/js/workersrc.js index 6c7590f6..20e64e99 100644 --- a/js/workersrc.js +++ b/js/workersrc.js @@ -31,6 +31,7 @@ function initializeCustomPDFViewerApplication() { PDFJS.openExternalLinksInNewWindow = true; PDFJS.isEvalSupported = false; PDFJS.workerSrc = document.getElementsByTagName('head')[0].getAttribute('data-workersrc'); + PDFJS.cMapUrl = document.getElementsByTagName('head')[0].getAttribute('data-cmapurl'); // The download has to be forced to use the URL of the file; by default // "PDFViewerApplication.download" uses a blob, but this causes a CSP error diff --git a/templates/viewer.php b/templates/viewer.php index 12b0cbe6..7f06763c 100644 --- a/templates/viewer.php +++ b/templates/viewer.php @@ -27,7 +27,8 @@ See https://github.com/adobe-type-tools/cmap-resources --> - +