PdfImage class final

A single image object on a PDF page.

Produced by PdfDocument.extractImages. objectIndex is the stable per-page integer position of this object in the page's object list; pass it to PdfDocument.renderImage to fetch the bitmap on demand.

Bitmap fields

bgra, bitmapWidth, and bitmapHeight are null when PdfDocument.extractImages was called with includeBitmap: false (the default, metadata-only mode). Use PdfDocument.renderImage to retrieve the composited BGRA bitmap for a specific image without re-enumerating the page.

When includeBitmap: true is passed, all three fields are populated for every image that has a renderable bitmap; they remain null for mask-only or otherwise unrenderable objects (when FPDFImageObj_GetRenderedBitmap returns null).

Image masks

Image mask objects (bits_per_pixel == 1) are included in the output and are not suppressed automatically. Callers can identify them via metadata.bitsPerPixel == 1.

Constructors

PdfImage({required int pageIndex, required int objectIndex, required PdfImageMetadata metadata, required PdfRect bounds, required List<String> filters, Uint8List? bgra, int? bitmapWidth, int? bitmapHeight})
Creates an immutable PdfImage.
const

Properties

bgra Uint8List?
The rendered BGRA pixel bytes, or null if the bitmap was not requested.
final
bitmapHeight int?
The rendered pixel height, or null if the bitmap was not requested.
final
bitmapWidth int?
The rendered pixel width, or null if the bitmap was not requested.
final
bounds PdfRect
Axis-aligned bounding box of the image in PDF user-space coordinates.
final
filters List<String>
The compression filter names applied to the image data, in order.
final
hashCode int
The hash code for this object.
no setteroverride
metadata PdfImageMetadata
Source-level metadata for this image (dimensions, DPI, colorspace).
final
objectIndex int
Position of this object in the page's object list (zero-based).
final
pageIndex int
Zero-based index of the page this image belongs to.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override