PdfAttachment

class PdfAttachment(val fileName: String, val bytes: ByteArray, val mimeType: String = "application/octet-stream", val description: String? = null)

A file embedded into the produced PDF.

Embedded files travel inside the document so a single PDF can carry a machine-readable companion — the canonical use is a ZUGFeRD / Factur-X invoice that embeds the structured factur-x.xml next to the human-readable pages.

Platform support:

  • JVM / Desktop (PdfBox) — full support. The file is registered in the document catalog's embedded-files name tree.

  • iOS / Android — the underlying PDF generators expose no embedded-file API, so attachments are silently skipped on those platforms.

Constructors

Link copied to clipboard
constructor(fileName: String, bytes: ByteArray, mimeType: String = "application/octet-stream", description: String? = null)

Properties

Link copied to clipboard

raw file contents.

Link copied to clipboard
val description: String? = null

optional human-readable description of the attachment.

Link copied to clipboard

name shown to the user and stored in the file specification (e.g. "invoice.xml").

Link copied to clipboard

MIME type recorded as the embedded stream subtype; defaults to "application/octet-stream".

Functions

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