From 02b71fe95d06722183f4582547b0511d52529394 Mon Sep 17 00:00:00 2001 From: cubercsl <2014cais01@gmail.com> Date: Thu, 2 Dec 2021 17:10:28 +0800 Subject: [PATCH] fix(pdfpreview): Support for non-latin characters As mentioned in https://github.com/wojtekmaj/react-pdf#support-for-non-latin-characters, pdf.js needs the bundled cMaps files to work. --- components/previews/PDFPreview.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/previews/PDFPreview.tsx b/components/previews/PDFPreview.tsx index 9a0f50f..0576ff6 100644 --- a/components/previews/PDFPreview.tsx +++ b/components/previews/PDFPreview.tsx @@ -38,6 +38,10 @@ const PDFPreview: FunctionComponent<{ file: any }> = ({ file }) => { onLoadProgress={({ loaded, total }) => { setLoadingText(`Loading PDF ${Math.round((loaded / total) * 100)}%`) }} + options={{ + cMapUrl: `//cdn.jsdelivr.net/npm/pdfjs-dist@${pdfjs.version}/cmaps/`, + cMapPacked: true, + }} >