PdfAttachment

data class PdfAttachment(val name: String, val filename: String, val description: String?, val mimeType: String?, val size: Long?, val bytesProvider: () -> ByteArray)

One embedded file attachment from the document — ISO 32000-1 §7.11.4.

Attachments live in the catalog's /Names /EmbeddedFiles name tree (PDF 1.4+) and/or hang off file-attachment annotations. Each one is a FileSpec dict pointing at one or more embedded-file streams; the preferred one is keyed by /UF (Unicode filename) with /F as fallback.

We resolve the bytes lazily — large attachments shouldn't be decoded until the caller asks for them.

Constructors

Link copied to clipboard
constructor(name: String, filename: String, description: String?, mimeType: String?, size: Long?, bytesProvider: () -> ByteArray)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Convenience for callers who want eager-but-cached bytes.

Link copied to clipboard

Pulls and decodes the embedded stream lazily. Empty array on failure.

Link copied to clipboard

Optional user-readable description (/Desc).

Link copied to clipboard

Author-supplied filename.

Link copied to clipboard

MIME type (/EF /F /Subtype). null if not declared.

Link copied to clipboard

Name-tree key (often the same as filename but not always).

Link copied to clipboard
val size: Long?

Reported size in bytes. May be null if /Params /Size is absent.