react-pdf-highlighter icon indicating copy to clipboard operation
react-pdf-highlighter copied to clipboard

Does not work with uploaded PDF

Open rybon opened this issue 3 years ago • 2 comments

When using an uploaded PDF converted to for example base64 the rendering of the PDF fails. Loading that very same PDF via a URL works fine.

I am using this example code from PDF.js to test: https://mozilla.github.io/pdf.js/examples/ Hello World using base64 encoded PDF

The problem is in PdfLoader.tsx in the getDocument call. Changing ...this.props to url fixed the issue. This ensures it works for both URLs and uploaded or local files.

Alternative: url.data ? { data: url.data, ...this.props } : { ...this.props }

rybon avatar Aug 31 '22 10:08 rybon

Also needs a change in PdfLoader.tsx componentDidUpdate to this.props.url.data !== url.data

rybon avatar Sep 09 '22 22:09 rybon

Could you please open a PR with this?

agentcooper avatar Nov 29 '22 12:11 agentcooper