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

fix: use one pdf worker for all documents and for all rerenders

Open jeetiss opened this issue 3 years ago • 5 comments

react-pdf v5.3 with file-loader creates new worker for all file's change and for all Document instances, so I create a singleton that reuse worker while rerenders and in different documents

jeetiss avatar Apr 09 '21 09:04 jeetiss

@wojtekmaj @jeetiss , does this help with loading a PDF fine when the browser is set to offline mode?

If it does, i'd really appreciate a sample reference. Thanks

juzoace avatar Nov 16 '22 15:11 juzoace

@wojtekmaj @jeetiss , does this help with loading a PDF fine when the browser is set to offline mode?

If it does, i'd really appreciate a sample reference. Thanks

No, this is unrelated. In order to work in "offline mode", make sure to properly Configure PDF.js worker so it is locally available and not loaded from a CDN.

paescuj avatar Nov 23 '22 09:11 paescuj

any progress?

will this help when handling large pdf?

KMJ-007 avatar Aug 17 '23 12:08 KMJ-007

any progress? what missing?

criskell avatar Feb 28 '24 04:02 criskell

will this help when handling large pdf?

No. This could help with multiple instances of React PDF initialized at the same time only.

what missing?

There are two main concerns.

First - is this still even needed if file-loader is no longer recommended and instead, we pass worker URL to PDF.js?

Second - the package has been completely rewritten since so this code isn't compatible with the latest head. Although that's a minor issue, it can easily be rebased.

wojtekmaj avatar Feb 29 '24 17:02 wojtekmaj