NutrientDocumentInterface class abstract
Abstract interface representing an open PDF document.
Concrete implementations are provided by each platform package:
NutrientDocumentAndroidinnutrient_flutter_androidNutrientDocumentIOSinnutrient_flutter_iosNutrientDocumentWebinnutrient_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:
- annotations — annotation CRUD, search, XFDF export/import
- bookmarks — bookmark CRUD
- forms — form field get/set
Each manager is independently extensible via factory methods on the platform document implementation.
Constructors
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
annotationsJsonto 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