Use the Headless Document API
masterThe Headless Document API allows you to open and manipulate PDF documents without displaying a viewer. This is ideal for batch processing, annotation management, and server-side operations.
Important: Always wrap document operations in a try-finally block and call await document.close() in the finally block to release native resources.
// Open a document without displaying a viewer
final document = await Nutrient.openDocument('/path/to/document.pdf');
try {
// Perform operations...
final pageCount = await document.getPageCount();
final annotations = await document.getAnnotations(0, AnnotationType.all);
// Save changes
await document.save();
} finally {
// Always close headless documents to release resources
await document.close();
}