尝试使用 PdfReact 组件显示 PDF 文件。加载 PDF 时,我不断收到此错误:
Warning: Ignoring invalid character "114" in hex strinpdf.worker.js:342
Warning: Ignoring invalid character "34" in hex stringpdf.worker.js:342
Warning: Ignoring invalid character "111" in hexstringpdf.worker.js:342
我的设置如下:
import React from 'react';
import ReactPDF from 'react-pdf/build/entry.webpack';
const About = () => {
return (
<div>
<ReactPDF file="../pdf/Resume.pdf" />
</div>
)
}
export default About;
最佳答案
找到解决方案:
我没有将 pdf 文件作为对象传递。这就是 PDF 渲染所需发生的全部事情。
关于javascript - 使用 ReactPDF 加载 React 时出现 PDF 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45982068/