PdfBuilder
Creates a brand-new PDF from scratch — the full (non-incremental) write path.
val bytes = PdfBuilder()
.setInfo(title = "Demo", author = "KitePDF")
.page { text(StandardFont.Helvetica, 24.0, 72.0, 700.0, "Hello, world!") }
.build()Builds the object graph (catalog → page tree → pages, each with an inlined /Resources and a content stream), then serializes a complete file: header, objects, a classic xref table, and a trailer. Page content is drawn with ContentStreamBuilder; text uses the standard-14 fonts (no embedding).
Content streams are FlateDecode-compressed by default (see build).
Functions
Commit a page sized width×height points from content (obtained via newPageContent). Pages appear in call order.
A fresh ContentStreamBuilder wired to this builder's font/image resources. Pair with addPage when page drawing must be driven imperatively — e.g. from a suspend layout routine that page's synchronous block can't host. Fonts/images used here are registered when addPage commits the builder.