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.
This commit is contained in:
cubercsl
2021-12-02 17:10:28 +08:00
committed by GitHub
parent c361dcc594
commit 02b71fe95d
+4
View File
@@ -38,6 +38,10 @@ const PDFPreview: FunctionComponent<{ file: any }> = ({ file }) => {
onLoadProgress={({ loaded, total }) => { onLoadProgress={({ loaded, total }) => {
setLoadingText(`Loading PDF ${Math.round((loaded / total) * 100)}%`) setLoadingText(`Loading PDF ${Math.round((loaded / total) * 100)}%`)
}} }}
options={{
cMapUrl: `//cdn.jsdelivr.net/npm/pdfjs-dist@${pdfjs.version}/cmaps/`,
cMapPacked: true,
}}
> >
<Page <Page
pageNumber={pageNumber} pageNumber={pageNumber}