Warning: Setting up fake worker. How to render PDF from ArrayBuffer using react-pdf in Next.js app? #1688
Replies: 7 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
I tried the copy "worker.min.js" to the public folder, but my
However, then in the browser I get:
So I need to perhaps compile it? What should I do now? |
Beta Was this translation helpful? Give feedback.
-
Yea I am getting this same issue right now. My guess is it's something that Next.js did... |
Beta Was this translation helpful? Give feedback.
-
I had a similar issue. Fix for me was using Next 13 instead of 14. |
Beta Was this translation helpful? Give feedback.
-
bumping this issue- experiencing the same problem using Next 14 |
Beta Was this translation helpful? Give feedback.
-
спасибо огромное всем! 2 дня искал решение проблемы, перешел на next 13 - все заработало |
Beta Was this translation helpful? Give feedback.
-
I'm using Next 14.1.4 and 'react-pdf' 9.1.1, it works for me just using:
This is how the Document component is setup:
Also, I added some config to the next.config.mjs as suggested in the docs (I'm not using turbopack, if you are, then follow the steps defined in the README): const nextConfig = {
+ swcMinify: false,
+ webpack: (config) => {
+ config.resolve.alias.canvas = false;
+ return config;
},
}; |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am getting these error messages in the chrome dev tools logs, when rendering the PDF
<Document>
in my simple Next.js app:It looks like I need to setup the worker somehow? Did I miss that in the docs (looks like so)? I am successfully receiving an ArrayBuffer after doing
fetch(apiPath)
to generate a PDF from LaTeX using thepdflatex
CLI (and I have verified the PDF is renderable by checking the PDF manually), but it's not working. Here is my UI code:And here is my API route to generate the PDF, if that helps:
And the utility:
Any suggestions or ideas on why my PDF is not rendering now, and just saying this where the
<Document />
was rendered?Beta Was this translation helpful? Give feedback.
All reactions