Prevent Editing the Content of a Text Annotation

In some cases, you may want to allow users to move, resize, change properties, etc. of text annotations but ensure they don’t change their content.

PSPDFKit for Web supports different annotation flags. One of these flags is lockedContents. When this flag is set to true, an annotation can be moved or resized, and its properties can be changed or the annotation can be deleted, but its text content cannot be edited or deleted:

}).then((instance) => {
  // Get the first annotation from a document.
  const annotation = instance.getAnnotation(0).first();

  // Update the annotation flags.
  const a = annotation.set("lockedContent", true);


This has been tested with PSPDFKit for Web 2023.4.6.