Skip to content

Unable to make it compatiable with latest version of pdfjs-dist #1581

Closed Answered by wojtekmaj
Rahul1726260 asked this question in Q&A
Discussion options

You must be logged in to vote

If you have multiple pdfjs-dist versions in your app (I'd advise you not to), default ways of copying/including worker file won't work, because:

When having one copy of pdfjs-dist, it will look like this:

\- node_modules
   |- pdfjs-dist (3.6)
   \- react-pdf

When having multiple copies, it will look like this:

\- node_modules
   |- pdfjs-dist (in your case: 3.9)
   |  \- node_modules
   |     \- pdfjs-dist (in your case: 3.6)
   \- react-pdf

When importing pdfjs-dist directly from your application, you'll import version 3.9, not 3.6.

  • If you copy the worker file using Webpack, Vite, or a custom script, you will need to change the directory you're copying from to node_modules/react-pdf/…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@wojtekmaj
Comment options

@Rahul1726260
Comment options

@attilaaronnagy
Comment options

@wojtekmaj
Comment options

@attilaaronnagy
Comment options

Answer selected by wojtekmaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1580 on August 01, 2023 12:09.