React-pdf: PDF not rendering despite onLoadSuccess triggered

Created on 23 Feb 2019  ·  15Comments  ·  Source: wojtekmaj/react-pdf

Hi Im having a problem. I load a pdf with this library. The onLoadSuccess is triggered. But the Document does not render.

I dont know what else to do. I just copy the example page.

Thanks

question

Most helpful comment

If it's of any help to anyone, I had the exact problem - no errors, but nothing rendering.

Added

<Page pageNumber={1} />

And it worked. Thanks @wojtekmaj for the links

All 15 comments

Any errors in the console?

@wojtekmaj. No no errors on console. It might be a stupid thing. But its driving me crazy. There is nothing indicating that something goes wrong. The on error functions are not being called either.

I have a similar issue. Instead of rendering the Pdf it says "Failed to load PDF file"
In the console i get:

pdf.worker.js:1 Uncaught SyntaxError: Unexpected token <
index.js:1446 Error: Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined".
at eval (pdf.js:11664)

Have the same issue. No errors at all. Some of pdf are rendered correctly, some not just white canvas instead of pages

@niktnikt See #52, #321

If others have this precise message also see these issues I mentioned above.

I have the same issue and it is very. very. frustrating.

@AmyshaDixon yeah, I decided not to render anything.

@acollazomayer I ended up using react-pdf-js instead just until this issue gets fixed. It doesn't have all the bells and whistles that this one does, but it gets the job done in the meantime.

If the issues mentioned are not helpful at all, and you don't see any errors in the console, or any network errors, check this Wiki entry:

https://github.com/wojtekmaj/react-pdf/wiki/Frequently-Asked-Questions#i-render-document-but-nothing-is-rendered-why

If that fails too, I'm going to need a minimum reproduction on something like CodeSandbox.

If it's of any help to anyone, I had the exact problem - no errors, but nothing rendering.

Added

<Page pageNumber={1} />

And it worked. Thanks @wojtekmaj for the links

i am facing the same issue too. work around of adding the Page tag works but now how i do make it to display all the pages

index.js:1375 Error: Setting up fake worker failed:
how do i fix this? plz help me i am stuck with this.

i am facing the same issue too. work around of adding the Page tag works but now how i do make it to display all the pages

@balu4k That's not a workaround, that's a proper solution for displaying one page :)

Check this recipe: https://github.com/wojtekmaj/react-pdf/wiki/Recipes#display-all-pages

@jaquesgrobler Thanks, that worked.

it occurs when we do ssr at backend and then server the page

Was this page helpful?
0 / 5 - 0 ratings