Passing Viewer in React Component as a prop

WebViewer Version: 8.11

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? Yes, React
Is your issue related to annotations? No

Please give a brief summary of your issue:
(Think of this as an email subject)
So, similar to what is done here, Apryse Documentation | Documentation , We want to pass viewer.current as a prop too along with the instance.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

  • Why this ? Because we want to preload all the files required ( worker, pdfnet, etc ) before hand so as to reduce the load time of files ( doc, pdf, images, audio, video ).
  • We are using a custom UI for our use case.
  • We have a component which shows the list of files, which user when clicks on get loaded on the pdftron ( which is a separate component ).
  • Is there a way to cache the files required for pdftron to run ?

Please provide a link to a minimal sample where the issue is reproducible: None. Custom Implementation.

Hi Ankit.jain,

Thank you for contacting us regarding Webviewer.

I think you could try storing the viewer.current in the context and pass it to the children component.