我正在使用一个反应 pdf 查看器 https://react-pdf-viewer.dev/docs/basic-usage/我想在本地设置工人。我尝试过这样做:
import pdfjsWorker from "pdfjs-dist/build/pdf.worker.entry";
<Worker workerUrl={pdfjsWorker}>
<Viewer
fileUrl={url}
defaultScale={SpecialZoomLevel.PageFit}
plugins={[
defaultLayoutPluginInstance
]}
/>
</Worker>
但是,这会引发一个警告:
警告:设置假工人
那么导入工人的正确方法是什么,为什么我会收到此警告?
我遇到了类似的问题,通过添加 pdf.worker.js 解决了它们
Git 参考 https://github.com/wojtekmaj/react-pdf/issues/321
我在worker.js的头部添加了js文件,即https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.worker.js https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.worker.js
Then I correct the version (2.10.377 to 2.3.200) as per the console error and it starts loading the pdf
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)