attachment

fun attachment(fileName: String, bytes: ByteArray, mimeType: String = "application/octet-stream", description: String? = null)

Embeds a file into the document. Repeatable — each call adds another attachment in source order. Only honoured by the JVM/Desktop backend; silently skipped on iOS and Android (see PdfAttachment).

Parameters

fileName

name shown to the user (e.g. "invoice.xml").

bytes

raw file contents.

mimeType

MIME type recorded as the embedded stream subtype.

description

optional human-readable description.