toNSData

fun <Error class: unknown class>.toNSData(): <Error class: unknown class>

Exposes the rendered PDF bytes as an NSData for friction-free Swift interop.

Swift sees this as pdfDocument.toNSData() and can write the result directly to disk via Data.write(to:) or feed it to PDFKit / share sheets without touching KotlinByteArray.

The returned NSData owns a fresh copy of the underlying bytes; mutating the original document (which is impossible — PdfDocument is immutable) would not affect previously returned data instances.