From b0ba269ef3f3dfaa90ec149b44d624ad0f0cae94 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: 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 6c7590f..20e64e9 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 12b0cbe..7f06763 100644 --- a/templates/viewer.php +++ b/templates/viewer.php @@ -27,7 +27,8 @@ Adobe CMap resources are covered by their own copyright but the same license: See https://github.com/adobe-type-tools/cmap-resources --> - + -- cgit v1.2.3