diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-06-21 15:02:46 +0300 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2019-06-27 17:50:43 +0300 |
commit | b0ba269ef3f3dfaa90ec149b44d624ad0f0cae94 (patch) | |
tree | 3c2580b9a31b82b9a583513351902c91e83ae0ac | |
parent | 32b481bdd621c27a01673f953e7597bab9828521 (diff) |
Fix load of character maps
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 <danxuliu@gmail.com>
-rw-r--r-- | js/workersrc.js | 1 | ||||
-rw-r--r-- | templates/viewer.php | 3 |
2 files changed, 3 insertions, 1 deletions
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 --> <html dir="ltr" mozdisallowselectionprint moznomarginboxes> - <head data-workersrc="<?php p($urlGenerator->linkTo('files_pdfviewer', 'vendor/pdfjs/build/pdf.worker.js')) ?>?v=<?php p($version) ?>"> + <head data-workersrc="<?php p($urlGenerator->linkTo('files_pdfviewer', 'vendor/pdfjs/build/pdf.worker.js')) ?>?v=<?php p($version) ?>" + data-cmapurl="<?php p($urlGenerator->linkTo('files_pdfviewer', 'vendor/pdfjs/web/cmaps/')) ?>"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="google" content="notranslate"> |