I'm trying to load a PDF file using data object or URL but react-pdf only output "Loading PDF".
I'm listening for events onLoadSuccess, onLoadError, onRenderSuccess, onRenderError but only onLoadSuccess has being fired.

I'm also trying to load using data parameter {data: UIntArray} loaded with a fetch request (cors checked)

This is the object passed as parameter
*

*
The url used in this example is public
React-PDF Document renders "Loading PDF ..."
Can someone help?
I have the same issue. I provide a Uint8Array to the file props of the Document component like this
<Document
file={{ data: file }}
>
where file is a Uint8Array.
I try to log each method : onLoadSuccess, onLoadError, onSourceError, onSourceSuccess.
Only onSourceSuccess is fired.
EDIT
I had the issue with worker so I've added these lines :
import { Document } from 'react-pdf/dist/entry.webpack';
import { pdfjs } from 'react-pdf';
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
But I think there is an error with webpack because in my browser console I can see :
Uncaught ReferenceError: window is not defined
Do you have an idea about this issue ?
@AntoninMarchardDev See the bottom of #190
I would add that you should store the Uint8Array file in the format { data: file } directly in the props otherwise you could face an issue where the page keeps rendering (see issue #308 for more information on this topic).
I would add that you should store the
Uint8Arrayfile in the format{ data: file }directly in the props otherwise you could face an issue where the page keeps rendering (see issue #308 for more information on this topic).
OMG, you're a life savior!
I had the exact same issue, and I was this close to giving up and starting to implement the whole thing from the ground up with pdf.js =))
Thanks a million
I would add that you should store the
Uint8Arrayfile in the format{ data: file }directly in the props otherwise you could face an issue where the page keeps rendering (see issue #308 for more information on this topic).
YES! I also had this issue. This fixed the continuous rerendering problem.
Most helpful comment
I would add that you should store the
Uint8Arrayfile in the format{ data: file }directly in the props otherwise you could face an issue where the page keeps rendering (see issue #308 for more information on this topic).