drawable

fun <Error class: unknown class>.drawable(drawable: PdfDrawable, width: <Error class: unknown class>? = null, height: <Error class: unknown class>? = null, tint: <Error class: unknown class>? = null, contentScale: <Error class: unknown class> = ContentScale.Fit, strokeMode: <Error class: unknown class> = VectorStrokeMode.Inherit, allowDownScale: Boolean = true)

Embeds a PdfDrawable in the document, dispatching to vector(...) or image(...) based on the variant. Useful when the call site loads a resource via DrawableResource.toPdfDrawable without knowing in advance whether the asset is XML or a raster.

Parameters that apply to only one variant are silently ignored for the other — tint and strokeMode take effect for vector drawables only, and contentScale takes effect for raster drawables only.

Parameters

drawable

the resource loaded via toPdfDrawable.

width

rendered width on the page; null lets the engine derive it from intrinsic dimensions (vector) or from the supplied height (raster, when height is non-null).

height

same logic mirrored for the vertical axis.

tint

vector-only — uniform colour applied to every fill.

contentScale

raster-only — how the bitmap fills the box. Defaults to ContentScale.Fit.

strokeMode

vector-only — whether the stroke is inherited, suppressed, or recoloured at draw time.


fun <Error class: unknown class>.drawable(resource: <Error class: unknown class>, width: <Error class: unknown class>? = null, height: <Error class: unknown class>? = null, tint: <Error class: unknown class>? = null, contentScale: <Error class: unknown class> = ContentScale.Fit, strokeMode: <Error class: unknown class> = VectorStrokeMode.Inherit, allowDownScale: Boolean = true)

Embeds a typed Compose Multiplatform DrawableResource inline inside the synchronous pdf { } DSL — auto-detects vector vs raster from the file's leading bytes at preflight time.

Returns immediately. The resource bytes are read during the suspend preflight pass that pdfAsync { } runs before layout, so the call site never has to be suspend itself. Build the document with com.conamobile.pdfkmp.pdfAsync instead of com.conamobile.pdfkmp.pdf when using this overload — the synchronous entry point has no preflight pass and throws a clear error when it sees a deferred node.

Parameter semantics match the eager drawable overload above — tint / strokeMode apply only when the resource turns out to be a vector, contentScale only when it turns out to be a raster.

Parameters

resource

typed Res.drawable.* reference produced by the Compose Multiplatform Resources plugin in the consumer project.