openDocument abstract method

Future<NutrientDocumentInterface> openDocument(
  1. String path, {
  2. String? password,
})

Opens a document without displaying a viewer (headless mode).

Returns a NutrientDocumentInterface that gives access to the full document API — annotations, bookmarks, forms, save, export, etc. — with no UI required.

path — file path or content URI to the PDF document. password — password for encrypted documents; omit for unprotected files.

The returned document holds native resources. Call NutrientDocumentInterface.close when done to release them.

Example:

final doc = await adapter.openDocument('assets/document.pdf');
await doc.annotations.exportXfdf();
await doc.save(outputPath: '/tmp/out.pdf');
await doc.close();

Implementation

Future<NutrientDocumentInterface> openDocument(
  String path, {
  String? password,
});