openDocumentFromBytes method
Opens a document from in-memory bytes without a viewer (headless).
Use when the document isn't available as a file. The native adapters persist the bytes to a temporary file and load that; the web adapter wraps them in a blob URL. Otherwise identical to openDocument — the returned document holds native resources, so call NutrientDocumentInterface.close when done.
final bytes = await File('report.pdf').readAsBytes();
final doc = await adapter.openDocumentFromBytes(bytes);
final pages = await doc.getPageCount();
await doc.close();
The default throws UnsupportedError; the bundled Android/iOS/web adapters override it.
Implementation
Future<NutrientDocumentInterface> openDocumentFromBytes(
Uint8List bytes, {
String? password,
}) {
throw UnsupportedError(
'openDocumentFromBytes is not supported by this adapter.',
);
}