openCosDocumentFromSource function
Future<CosDocument>
openCosDocumentFromSource(
- PdfByteSource source, {
- String password = '',
- PdfSourceLoadOptions options = const PdfSourceLoadOptions(),
Opens a CosDocument from an asynchronous source, fetching only the
bytes it needs.
The loader reads the header probe, walks the cross-reference chain with ranged reads, and then fetches the byte ranges of the live objects (skipping free space and superseded incremental-update revisions) into a sparse buffer that the ordinary synchronous CosDocument.open consumes.
When the length is unknown, the cross-reference machinery is broken, or a
ranged read fails, it falls back to a plain sequential download and opens
that - so a non-range-capable server still works, just without the
bandwidth savings. password is forwarded to CosDocument.open.
Implementation
Future<CosDocument> openCosDocumentFromSource(
PdfByteSource source, {
String password = '',
PdfSourceLoadOptions options = const PdfSourceLoadOptions(),
}) async =>
(await openCosDocumentFromSourceWithStatus(
source,
password: password,
options: options,
))
.document;