简体   繁体   中英

PDF error while loading in react using ReactPDF

Trying to display a PDF file using the PdfReact component. While loading the PDF, I keep getting this error:

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 

My setup looks like this:

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;

Found the solution:

I was not passing the pdf file as an object. That'a all that needed to happen for the PDF to render.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM