Multiple Instances are not working

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
8.7.5
Detailed description of issue
we are using pdf viewer with multiples instances with two different id’s.

  1. one with editing features like annotations/redactions etc.
  2. only viewing purpose.

but after initialization any changes was made to the first one for example if we select annotation option the same is appearing in the second viewer as well.

Expected behaviour
Each viewer should work as an independent

Does your issue happen with every document, or just one?
Yes

Please help on this scenario

Hi there,

How are you initializing the 2 instances? Are they mounted on 2 separate DOM elements?
Note that using multiple instances will consume a lot more memory, see this thread for details:

See this forum post for another example of implementation:

Best regards,
Kevin Kim

Hey Thanks for the quick reply. yes they are mounted in the same page side by side with two different div elements with the id’s like ‘document1’ and ‘document2’.

Are there any error messages when you create an annotation? Can you share a minimal sample?

Hi @kkim after initializing the viewers if i made any changes for example if i select view mode in on instance if i refresh the page other viewer is also selecting the same option. please check the image 1 and image 2 for clarification. i am attaching sample project link to replicate the issue .https://anvesa01-my.sharepoint.com/:u:/g/personal/prajneshu_khandavalli_anvesa_com/EUGvTev8HgRBgWBObEIjUgkBXtJczo2Lf0rrq-QDLBDrow?e=pskeEa


Hi there,

Running the project, it looks like things are working as expected. Performing an action on one viewer doesn’t invoke the same action on the other viewer:

However, it looks like you are dynamically creating 2 instances instead of creating 2 separate WebViewer instantiation in your app.js file. You will want to keep them separate so you can customize each instance on its own.

best regards,
Kevin Kim