This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/flutter/annotations/create-edit-and-remove/annotation-flags.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Define annotation behavior in a document with flags in Flutter | Nutrient

Every Annotation(opens in a new tab) in a document can specify AnnotationFlag(opens in a new tab) values that define its behavior and capabilities. Access these flags directly on annotation objects with Annotation.flags.

Capabilities of flags

Annotation flags are part of the PDF specification. They define an annotation’s behavior, its appearance onscreen and on paper, and the editing actions available to your users. You can use flags to control these behaviors:

  • Mark an annotation as hidden so it won’t be displayed or printed.
  • Set print to include the annotation in print output while keeping it hidden onscreen.
  • Set the locked and lockedContents flags to prevent users from editing an annotation.

For a complete list of available flags, refer to the AnnotationFlag(opens in a new tab) API reference.

Example

The following example creates a locked annotation that users can’t edit:

import 'package:nutrient_flutter/bindings.dart';
void createReadOnlyAnnotation() {
// Create a new text annotation.
final annotation = FreeTextAnnotation(
pageIndex: 0,
bbox: [50.0, 650.0, 200.0, 50.0],
text: TextContent(
format: TextFormat.plain,
value: 'This is a free text annotation',
),
// Set the `readOnly` flag to prevent editing.
flags: [AnnotationFlag.readOnly, AnnotationFlag.print],
... // Other annotation properties.
);
// Add the annotation to the document.
controller.document.annotations.addAnnotation(annotation);
}