# Multiple Instances are not working

**URL:** <https://pdfjs.community/t/multiple-instances-are-not-working/3472>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [October 10, 2024, 8:01am UTC](https://pdfjs.community/t/multiple-instances-are-not-working/3472 "2024-10-10T08:01:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![prajneshu.khandavall](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@prajneshu.khandavall](https://pdfjs.community/u/prajneshu.khandavall)\
**Post date:** [October 10, 2024, 8:01am UTC](https://pdfjs.community/t/multiple-instances-are-not-working/3472/1 "2024-10-10T08:01:29Z")

</div>

**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

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [October 10, 2024, 1:59pm UTC](https://pdfjs.community/t/multiple-instances-are-not-working/3472/3 "2024-10-10T13:59:57Z")

</div>

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:

> [@Load many WebViewer, the browsers automatically refresh on IPhone and Ipad devices](https://pdfjs.community/t/load-many-webviewer-the-browsers-automatically-refresh-on-iphone-and-ipad-devices/2824):
>
> Which product are you using? PDF.js Express Viewer PDF.js Express Version UI version ‘8.7.0’ Core version ‘8.7.4’ webviewer.min.js ‘8.7.4’ Detailed description of issue I want to load 7 PDF WebViewers in my blazor WebAssembly. On iPhone and iPad devices, the Chrome and Safari browsers automatically refresh when loaded into the 5th WebViewer. Expected behaviour {Provide a screenshot or description of the expected behaviour} Does your issue happen with every document, or jus…

See this forum post for another example of implementation:

> [@Two instances on different elements, licenseKey isn't sending to the 2nd](https://pdfjs.community/t/two-instances-on-different-elements-licensekey-isnt-sending-to-the-2nd/3116/6):
>
> also, just to mention, I don’t think I’ve read anywhere explicitly that you can’t use two instances at the same time in your documentation…I would say there’s a difference between “we don’t suggest it” and “it’s not possible”. As far as I can tell, it is not possible and being able to find that information would have saved me a good chunk of time.

Best regards,  
Kevin Kim

---

<div class="post-metadata">

**Author:** ![prajneshu.khandavall](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@prajneshu.khandavall](https://pdfjs.community/u/prajneshu.khandavall)\
**Post date:** [October 10, 2024, 2:16pm UTC](https://pdfjs.community/t/multiple-instances-are-not-working/3472/4 "2024-10-10T14:16:59Z")

</div>

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’.

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [October 10, 2024, 5:31pm UTC](https://pdfjs.community/t/multiple-instances-are-not-working/3472/5 "2024-10-10T17:31:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![prajneshu.khandavall](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@prajneshu.khandavall](https://pdfjs.community/u/prajneshu.khandavall)\
**Post date:** [October 11, 2024, 6:09am UTC](https://pdfjs.community/t/multiple-instances-are-not-working/3472/6 "2024-10-11T06:09:24Z")

</div>

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](https://anvesa01-my.sharepoint.com/:u:/g/personal/prajneshu_khandavalli_anvesa_com/EUGvTev8HgRBgWBObEIjUgkBXtJczo2Lf0rrq-QDLBDrow?e=pskeEa)

 ![image1](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/0/008474d7605b12e1243218d5cff1284a7d97c2b5.jpeg)  
 ![image2](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/4/4a310b463535d0bfc65d87fc838c7894b433e77d.png)

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [October 11, 2024, 4:26pm UTC](https://pdfjs.community/t/multiple-instances-are-not-working/3472/7 "2024-10-11T16:26:54Z")

</div>

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:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/f/f3e1405f5494580e15cd1b21a483be1b26d7d019.jpeg)

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
