toPdfDrawable
Loads a Compose Multiplatform DrawableResource without caring whether it's XML (parsed into a VectorImage) or a raster bitmap (kept as raw bytes). The leading bytes of the file are inspected — anything that looks like XML is parsed as a vector, everything else is returned as a PdfDrawable.Raster.
Pair this with the drawable(...) DSL extension to render a resource regardless of its underlying format:
val any = Res.drawable.icon_or_photo.toPdfDrawable()
pdf {
page { drawable(any, width = 64.dp) }
}Content copied to clipboard
Falls back to the toBytes / toVectorImage path when the call site already knows which variant to expect.