PdfiumDocument class

An open PDF. All PDFium work happens in one shared background isolate; this object holds the document's id there and its page sizes.

Close a document with close when done with it. A document that is garbage-collected without being closed is closed then, as a safety net, but its native memory is held until the collector gets to it.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isClosed → bool
Whether the document has been closed; it can't be used after that.
no setter
pageCount → int
The number of pages.
no setter
pageSizes → List<Size>
Each page's displayed size in points (rotation applied).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → Future<void>
Frees the document. The worker runs this ahead of anything queued and drops the document's queued requests (their futures fail), so closing isn't held up behind a strip of thumbnails.
Links on a page: annotations and web addresses written as text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(int page, {required int fullWidth, required int fullHeight, Rect? region, PdfPriority priority = PdfPriority.visible}) → PdfRenderTask
Renders page page (0-based) drawn at fullWidth x fullHeight pixels, returning the region region of it (all of it by default).
renderThumbnail(int page, {required int width, PdfPriority priority = PdfPriority.background}) → Future<PdfRenderedImage>
A whole page scaled down to width pixels wide.
renderThumbnailTask(int page, {required int width, PdfPriority priority = PdfPriority.background}) → PdfRenderTask
renderThumbnail as a cancellable task, for a thumbnail that may scroll away (or whose document may close) before it's drawn. A page out of range fails the task with PdfEngineException, like any other render error, rather than throwing here.
Matches of query on one page (case-insensitive; a phrase may wrap lines), and whether the page has any text at all.
text(int page, {PdfPriority priority = PdfPriority.prefetch}) → Future<PdfPageText>
The page's text with each character's box.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

openBytes(Uint8List bytes, {String? password}) → Future<PdfiumDocument>
Opens a PDF held in memory.
openFile(String path, {String? password}) → Future<PdfiumDocument>
Opens a PDF file. Throws PdfOpenException with PdfOpenError.password when it needs a (different) password.