ImageNode

data class ImageNode(val bytes: ByteArray, val width: Dp?, val height: Dp?, val contentScale: ContentScale, val allowDownScale: Boolean = true, val altText: String? = null) : PdfNode

A bitmap image embedded in the document.

Width and height are optional: leave one or both null and the layout engine derives the missing dimension from the image's intrinsic aspect ratio (sniffed from the encoded header — see com.conamobile.pdfkmp.image.readImageInfo). When both are null, the intrinsic pixel size is used as-is, mapped 1px → 1pt.

Supported formats are whatever the platform decoder accepts: PNG and JPEG everywhere, plus WebP / HEIF on platforms that have native support (Android 10+ for HEIF, iOS 11+ for HEIF and WebP).

Constructors

Link copied to clipboard
constructor(bytes: ByteArray, width: Dp?, height: Dp?, contentScale: ContentScale, allowDownScale: Boolean = true, altText: String? = null)

Properties

Link copied to clipboard

when true (default), the platform backend subsamples the source bitmap so its pixel dimensions roughly match the rendered size at 200 DPI before drawing. Pass false to keep every source pixel — useful for one-off high-fidelity assets where the raw resolution needs to survive into the produced PDF.

Link copied to clipboard
val altText: String? = null

Accessibility description of the image — consumed by backends that write tagged structure (/Alt entries) so screen readers can describe the picture. null marks it as decorative.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val height: Dp?
Link copied to clipboard
val width: Dp?

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int