# Annotations going to Readonly mode when accessed the same webviewer from multiple clients

**URL:** <https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543>\
**Category:** Technical Support\
**Created:** [March 1, 2021, 4:12am UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543 "2021-03-01T04:12:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiran.patil](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kiran.patil](https://pdfjs.community/u/kiran.patil)\
**Post date:** [March 1, 2021, 4:12am UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/1 "2021-03-01T04:12:00Z")

</div>

**PDF.js Express Version**  
Version: 7.2.0

**Detailed description of issue**  
Annotations goes into Read-only mode. I have put condition of sampleProject, when it is true then only then it makes annotations readonly. But when I access same annotations from one account with readOnly set to true and another account with readOnly set to false, both have same annotations loaded then on account where readOnly mode is set to false, some annotations goes into readOnly mode.

I have tried removing readOnly(true) and then tried to load and get that annotations to edit mode but still after refreshing, annotations are in readOnly mode.

Need urgent solution for this major issue.

**Expected behavior**  
Annotations should not go into read-only mode. They should be in read-only mode only when the certain condition is true.

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

**Code snippet**  
`document.getElementById('viewer')).then((instance: any) => {`  
` instance.setReadOnly(false);`  
` if(this.isSampleProject) {`  
` instance.setReadOnly(true);`  
` }`

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [March 1, 2021, 5:40pm UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/2 "2021-03-01T17:40:51Z")

</div>

Hey there,

This sounds like an issue with your implementation and not with PDF.js Express.

Just a few questions:

- Is is always the same annotations that go into read only mode? Or is it random?
- Does this happen on just a specific document or every document
- Are you using the REST API to extract and load annots?

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![kiran.patil](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kiran.patil](https://pdfjs.community/u/kiran.patil)\
**Post date:** [March 7, 2021, 7:39am UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/3 "2021-03-07T07:39:53Z")

</div>

Hi Logan,

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/7b9596eefc6471a67524c29046c58c124c1c8ad7.png)  
Here you can see in the above screenshot, that some are in readOnly state and some are in editing state. I have selected all the annotations. Here `instance.setReadOnly(false)`. Note that my selection color is purple.

1. Random.
2. Every document
3. For export annotations, I use `instance.annotManager.exportAnnotations()` and same for import `Instance.annotManager.importAnnotations()`

This is causing too much of problems for us. An urgent fix is needed for this.

Can we manually set those un-editable(read-only) annotations to editable ?

Also I am able to draw/perform operations over annotations where some annotations are in read-only mode. So this understands that `instance.setReadOnly()` is false. Now why some annotations are different ?

Please note that after migrating to 7.3.1, we have cleared all the previous data.

Here is the annotation - (Here readonly is false, still it appears as readOnly as i am unable to edit/move it)

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/114644b18a87bd771d185e3a82870fbed1a897b5.png)  
And its xfdf -  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/8c381466d721c2d639c42e17e77db5d12f0ba6e3.png)

I have seen in my testing that if I copy this xfdf then that annotation also goes into readonly/viewOnly mode.

Thanks  
Kiran

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [March 8, 2021, 5:47pm UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/4 "2021-03-08T17:47:27Z")

</div>

Are the annotations that are “read-only” flattened into the document? PDF.js Express will render flattened annotations as unselectable bitmaps unless they are extracted and loaded as XFDF.

---

<div class="post-metadata">

**Author:** ![kiran.patil](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kiran.patil](https://pdfjs.community/u/kiran.patil)\
**Post date:** [March 8, 2021, 6:14pm UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/5 "2021-03-08T18:14:50Z")

</div>

How to check if the annotations are flattened into document or not. We didn’t any function/api for flattening.

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [March 8, 2021, 7:35pm UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/6 "2021-03-08T19:35:46Z")

</div>

By flattened I mean annotations that already exist in the document when the document is loaded

---

<div class="post-metadata">

**Author:** ![kiran.patil](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kiran.patil](https://pdfjs.community/u/kiran.patil)\
**Post date:** [March 18, 2021, 6:57am UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/7 "2021-03-18T06:57:11Z")

</div>

No, I have tried removing this - `instance.annotManager.importAnnotations(xfdfString);`. Annotations didn’t get loaded when this is removed. Means we are loading annotations over the plan still they are going in to readonly mode.

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [March 18, 2021, 2:41pm UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/8 "2021-03-18T14:41:56Z")

</div>

Do you have `disableFlattenedAnnotations ` set?

```javascript
WebViewer({
  disableFlattenedAnnotations: true,
  ...otherOptions
}).then(instance => {
  // ...
})

```

---

<div class="post-metadata">

**Author:** ![kiran.patil](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kiran.patil](https://pdfjs.community/u/kiran.patil)\
**Post date:** [March 18, 2021, 2:47pm UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/9 "2021-03-18T14:47:02Z")

</div>

Hi Logan,

I have resolved this issue. Actually it was a problem of different Admin accesses of same annotations.

> setIsAdminUser(true).

It’s resolved now.

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [March 22, 2021, 9:23pm UTC](https://pdfjs.community/t/annotations-going-to-readonly-mode-when-accessed-the-same-webviewer-from-multiple-clients/543/10 "2021-03-22T21:23:53Z")

</div>


