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

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) => {
if(this.isSampleProject) {

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?


Hi Logan,

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)

And its xfdf -

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


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.

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

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

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.

Do you have disableFlattenedAnnotations set?

  disableFlattenedAnnotations: true,
}).then(instance => {
  // ...

Hi Logan,

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


It’s resolved now.