react-pdf 给出 TypeError: 当设置 cmapUrl 选项时无法读取 null 的属性(读取 'sendWithPromise')

问题描述 投票:0回答:1

我用“pdf-react”实现了 pdf 预览器。

当字体为英文字体时,显示pdf文件没有问题, 但是当我使用非英文字体时就会出现问题。 (它加载没有文本的页面,并带有警告消息:

cmapreaderfactory not initialized see the useworkerfetch parameter

所以我按照wiki将cmap选项添加到文档中:

<Document options={options} />;
https://github.com/wojtekmaj/react-pdf/blob/main/README.md

我尝试了vite和外部CDN方法,但这两种方法都给了我

Cannot read properties of null (reading 'sendWithPromise')  

错误(以及因此出现的一堆其他错误)

我研究了网络但找不到解决方案..

有人知道为什么会发生这种情况/如何解决这个问题吗?

reactjs pdf.js react-pdf pdfjs-dist
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.