Java · v1.8.0 · MIT

Java PDF layout engine for structured business documents.

Describe documents. Render polished PDFs. A semantic layout engine for Java services that need structured, paginated, theme-driven output — CVs, invoices, proposals, reports.

No drawing API. No pixel arithmetic. You compose ParagraphNode, TableNode, SectionNode; GraphCompose handles measurement, pagination, fonts, and PDFBox rendering.

Cinematic project proposal preview Cinematic invoice preview Blue Banner CV preview
NEW

Building your own templates?

The layered architecture guide walks you through the five-folder pattern — data / theme / components / widgets / presets — with a worked CV example, widget cookbook, and step-by-step contributor checklist. New templates and major rewrites follow this shape.

30 lines → one invoice

The whole stack — theme tokens, table, totals, chrome — behind one fluent DSL.

Atomic pagination

Tables split row-by-row, rows are atomic, layer stacks atomic. No manual page math.

14 CV presets, 14 letter pairs

Every preset is one final class with a one-liner create(BusinessTheme) factory.

Tested at every layer

819 green tests, layout snapshots per preset, pixel-diff visual parity gate, public-API leak guards.

Maven Central. One dependency.

Maven

<dependency>
  <groupId>io.github.demchaav</groupId>
  <artifactId>graph-compose</artifactId>
  <version>1.8.0</version>
</dependency>

Gradle

dependencies {
  implementation(
    'io.github.demchaav:graph-compose:1.8.0'
  )
}

30-second hello world

try (var doc = GraphCompose
        .document(out).create()) {
  doc.pageFlow()
     .addParagraph("Hello, GraphCompose")
     .addList(l -> l.items(
         "PDF", "DOCX", "Tables"))
     .build();
  doc.buildPdf();
}

50+ generated PDFs you can inspect.

Every example below is a real, runnable Java file. Click the preview to open the rendered PDF, or jump straight into the source.

Loading examples...

Author intent stays separate from PDF rendering.

  1. Semantic DSL. You build a tree of ParagraphNode, TableNode, SectionNode, LayerStackNode, CanvasLayerNode.
  2. Layout pass. The engine resolves measurements, pagination, decoration, overlays. Output is a LayoutGraph — geometry only, no draw calls.
  3. Render backend. The FixedLayoutBackend consumes placed fragments. Default: PdfFixedLayoutBackend via PDFBox. DOCX backend exists for editable output.

For services that produce structured PDFs at scale.

Stream straight into HTTP responses

session.writePdf(OutputStream) writes incrementally with no in-memory buffering. Spring Boot, Quarkus, Micronaut, or plain Java HTTP.

Snapshot-tested layouts

Every preset has a layout-graph JSON baseline plus a pixel-diff visual parity baseline. Regressions surface on the first run.

Theme tokens, not magic numbers

BusinessTheme.modern() / .classic() / .executive() set palette, typography, table styles. Override one or all.

Markdown-aware bodies

Inline **bold**, *italic*, _italic_ markers parsed in every paragraph and list block automatically.