NutrientDocumentInterface class abstract

Abstract interface representing an open PDF document.

Concrete implementations are provided by each platform package:

  • NutrientDocumentAndroid in nutrient_flutter_android
  • NutrientDocumentIOS in nutrient_flutter_ios
  • NutrientDocumentWeb in nutrient_flutter_web

Accessing a Document

Via the controller (view-attached):

NutrientView<MyController>(
  documentPath: 'assets/document.pdf',
  onControllerReady: (controller) async {
    final pageCount = await controller.document.getPageCount();
    final bookmarks = await controller.document.bookmarks.getBookmarks();
    await controller.document.annotations.addAnnotationJson(json);
  },
)

Headless (no-UI):

final doc = await adapter.openDocument('path/to/doc.pdf');
await doc.save();
await doc.close();

Managers

Domain-specific operations are grouped into managers:

Each manager is independently extensible via factory methods on the platform document implementation.

Constructors

NutrientDocumentInterface()

Properties

annotations → AnnotationManagerInterface
Annotation operations (CRUD, search, XFDF export/import).
no setter
bookmarks → BookmarkManagerInterface
Bookmark operations (CRUD, page filtering).
no setter
forms → FormManagerInterface
Form field operations (get/set values, list fields).
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

applyInstantJson(String annotationsJson) → Future<bool>
Applies Instant JSON annotationsJson to the document.
close() → Future<bool>
Closes the document and releases all associated resources.
exportInstantJson() → Future<String?>
Exports the current annotations as an Instant JSON string.
exportPdf({DocumentSaveOptions? options}) → Future<Uint8List>
Exports the document as raw PDF bytes.
getAuthorName() → Future<String>
Returns the current annotation author/creator name.
getPageCount() → Future<int>
Returns the total number of pages in the document.
getPageInfo(int pageIndex) → Future<PageInfo>
Returns information about the page at pageIndex.
hasUnsavedChanges() → Future<bool>
Whether the document has unsaved changes that save would persist.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save({String? outputPath, DocumentSaveOptions? options}) → Future<bool>
Saves the document.
setAuthorName(String name) → Future<void>
Sets the annotation author/creator name.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited