PdfDocument
A fully-rendered PDF document, ready to be persisted or transferred.
Instances are immutable and safe to share across threads. The encoded bytes are produced once during pdf and reused for every accessor call — toByteArray returns a defensive copy so the caller cannot mutate the library-internal buffer.
kotlinx-io is used for file I/O so save works the same way on Android, iOS, and any future Kotlin/JVM, Kotlin/Native, or Kotlin/JS target without platform-specific code.
Properties
Every hyperlink annotation captured during rendering. Powers :pdfkmp-viewer's clickable-link overlay — see PdfHyperlink for the coordinate system. Empty for documents that were rendered before the recording infrastructure existed.
Every laid-out text run captured during rendering, in draw order. Powers :pdfkmp-viewer's text selection overlay — see PdfTextRun for the coordinate system. Empty for documents that were rendered before the recording infrastructure existed (e.g. tests that build a PdfDocument manually).