PdfDocument class abstract

Handles PDF document loaded on memory.

Constructors

PdfDocument({required String sourceName})
Constructor to force initialization of sourceName.

Properties

events → Stream<PdfDocumentEvent>
Stream to notify change events in the document.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isEncrypted → bool
Determine whether the PDF file is encrypted or not.
no setter
pages ↔ List<PdfPage>
Pages.
getter/setter pair
permissions → PdfPermissions?
Permission flags.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sourceName → String
File path, asset:[ASSET_PATH] or memory: depending on the content opened.
final

Methods

assemble() → Future<bool>
Assemble the document after modifying pages.
associateFontManager(PdfFontManager fontManager, {PdfFontLoadResultCallback? onLoadComplete, PdfFontLoadProgressCallback? onProgress}) → PdfFontManagerAssociation
Associate a PdfFontManager to the document to handle font loading/substitution for missing fonts.
dispose() → Future<void>
PdfDocument must have dispose function.
encodePdf({bool incremental = false, bool removeSecurity = false}) → Future<Uint8List>
Save the PDF document.
isIdenticalDocumentHandle(Object? other) → bool
Determine whether document handles are identical or not.
loadOutline() → Future<List<PdfOutlineNode>>
Load outline (a.k.a. bookmark).
loadPagesProgressively<T>({PdfPageLoadingCallback<T>? onPageLoadProgress, T? data, Duration loadUnitDuration = const Duration(milliseconds: 250), int? startPageNumber}) → Future<void>
Load pages progressively.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reloadPages({List<int>? pageNumbersToReload}) → Future<void>
Reload specified pages.
toString() → String
A string representation of this object.
inherited
useNativeDocumentHandle<T>(FutureOr<T> task(int nativeDocumentHandle)) → Future<T>
Execute native document task with the native document handle.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

createFromJpegData(Uint8List jpegData, {required double width, required double height, required String sourceName}) → Future<PdfDocument>
Creating a PDF document from JPEG data.
createNew({required String sourceName}) → Future<PdfDocument>
Creating a new empty PDF document.
openAsset(String name, {PdfPasswordProvider? passwordProvider, bool firstAttemptByEmptyPassword = true, bool useProgressiveLoading = false}) → Future<PdfDocument>
Opening the specified asset.
openCustom({required FutureOr<int> read(Uint8List buffer, int position, int size), required int fileSize, required String sourceName, PdfPasswordProvider? passwordProvider, bool firstAttemptByEmptyPassword = true, bool useProgressiveLoading = false, int? maxSizeToCacheOnMemory, void onDispose()?}) → Future<PdfDocument>
Opening the PDF from custom source.
openData(Uint8List data, {PdfPasswordProvider? passwordProvider, bool firstAttemptByEmptyPassword = true, bool useProgressiveLoading = false, String? sourceName, bool allowDataOwnershipTransfer = false, int? maxSizeToCacheOnMemory, void onDispose()?}) → Future<PdfDocument>
Opening the PDF on memory.
openFile(String filePath, {PdfPasswordProvider? passwordProvider, bool firstAttemptByEmptyPassword = true, bool useProgressiveLoading = false}) → Future<PdfDocument>
Opening the specified file. For Web, filePath can be relative path from index.html or any arbitrary URL but it may be restricted by CORS.
openUri(Uri uri, {PdfPasswordProvider? passwordProvider, bool firstAttemptByEmptyPassword = true, bool useProgressiveLoading = false, PdfDownloadProgressCallback? progressCallback, bool preferRangeAccess = false, Map<String, String>? headers, bool withCredentials = false, Duration? timeout}) → Future<PdfDocument>
Opening the PDF from URI.