Samples
Pre-built PdfDocuments used by the bundled sample apps and as living documentation of the API.
Each function in this object returns a freshly-rendered document. Calling the function more than once produces independent PdfDocument instances — the rendering pipeline is repeated on every call, which is intentional so changes to bundled fonts or to the renderer take effect without any cache invalidation.
The samples cover the public API surface roughly in order of complexity:
helloWorld — a single-page document with one styled line.
typography — every text knob (size, weight, italic, color, custom line height) on one page.
longBody — auto-paginated multi-paragraph body text demonstrating the default
MoveToNextPagestrategy.slicedBody — the same body using
Sliceso paragraphs are split at line boundaries instead of being moved whole.
Functions
Visually verifies cross-axis alignment dedup across containers — the scenario that used to overflow when a parent's non-Start alignment stacked on top of a child's non-Start TextAlign.
Machine-readable codes: QR symbols at several error-correction levels plus Code 128 barcodes — all pure vector, no rasterisation, no external dependencies.
A polished, brochure-style PDF designed for the README hero image. Mixes large display type, gradient banners, stat cards, a styled table, decorative shapes, dividers, and rich text — exercising the library's visual range in a single 2-page document.
Demonstrates VerticalArrangement.SpaceBetween on a column: header pinned to the top, footer pinned to the bottom of the page.
Custom design composition: hero image with text overlay (using box), three statistics cards (using card), and a styled todo list (using decorated column / row). Demonstrates how the three new primitives combine to build production-grade layouts.
Demonstrates DocumentScope.defaultPagePadding vs. per-page override. The first page uses the document default; the second page tightens it.
Decoration extras: drop shadows, dashed / dotted borders, the free-draw vector DSL, and the uniform grid container.
AcroForm fields and accessibility metadata: text fields, a checkbox, image alt text, and best-effort PDF/A identification. Fields are interactive in Desktop readers; Android and iOS render consistent static visuals.
Single page, one line of bold blue text. The simplest API call.
Demonstrates the allowDownScale knob on image(...) — handy for documents that embed dozens or hundreds of high-resolution photos where the source pixels would otherwise dwarf the rendered size.
Long body text that overflows a single page. Uses the default PageBreakStrategy.MoveToNextPage so each paragraph stays whole.
A table far taller than one page, sliced between rows with the header repeated at the top of every continuation page — the classic multi-page invoice / inventory listing.
Bookmarks, a clickable auto-generated table of contents, and internal cross-reference links. Open the result in a desktop reader to see the outline sidebar and jump between chapters.
Newspaper-style layout: a wide headline over balanced multi-column body text, plus right-to-left paragraphs that auto-detect their direction from the content.
Document-level "chrome" features grouped onto one document so they can be tested together — every page carries a header, footer with Page X of Y, and a watermark; one page demos clickable hyperlinks; the last page exercises the i18n font references for CJK / Arabic / Persian. Pages are chained via PageBreakStrategy.Slice so the long body section overflows naturally and the page numbering sees totalPages > 1.
Book-style page chrome — no header on the cover, mirrored headers on even/odd pages via com.conamobile.pdfkmp.node.PageContext's parity helpers — plus a landscape page mixed into a portrait document.
Demonstrates the row / column / weighted DSL: a header row with a left title, flexible spacer, and right metadata; a body column with three weighted blocks; a footer row centred via HorizontalArrangement.Center.
End-to-end showcase that touches every feature added in the v1 polish sprint: rich-text spans, text alignment + decorations, dividers + dashed/dotted lines, per-corner radius and per-side borders, gradient backgrounds, circle / ellipse primitives, bulleted and numbered lists, headers + footers with Page X of Y, watermarks, and clickable links.
Same content as longBody but with PageBreakStrategy.Slice: long paragraphs are split at line boundaries instead of being pushed whole-cloth onto a new page.
Embeds a tall image that doesn't fit on a single page so the PageBreakStrategy.Slice logic kicks in and splits the picture across two pages.
Demonstrates the table DSL — header + alternating-row body, mixed fixed and weighted columns, custom border, and rounded corners.
Advanced text features on one page: full justification, line clamping with ellipsis, soft-hyphen breaks, and superscript / subscript spans.
Showcases every TextStyle knob in one page — pick this sample as a reference when figuring out what is configurable.
Demonstrates advanced SVG features: gradients, elliptical arcs, group transforms — all rendered as vector PDF operators.
Demonstrates vector / SVG icons — both # <vector> XML and standard <svg> are accepted, scaled to a requested size, and optionally tinted at draw time.
Embeds a developer-supplied image alongside text. The image bytes normally come from app assets / network — sample apps load them from their bundle and pass them in here.