Java 17+ · v2.4.1 · MIT

Business documents, composed in Java.

A layout engine that measures, paginates and renders structured PDFs — with ready-made templates for CVs, invoices and proposals.

Cinematic Invoice, first page
Cinematic Invoice Open PDF Details

What you get

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.

26 CV presets, 15 matching letters

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

Tested at every layer

A full-reactor verify gate on every push: layout snapshots per preset, pixel-diff visual parity, public-API leak guards.

Generated PDFs you can inspect.

Every document below is drawn by a real, runnable Java file. Click a preview to open the viewer: it pages through the whole document, moves across the rest of its family, and links the PDF, the source and what reproducing it takes.

Loading examples...

Maven Central. Add what you are building.

Every coordinate below is the v2.4.1 release. The fonts and emoji have version numbers of their own, and the bundle pins them for you.

PDF from your own layout

The engine and its PDF backend.

Maven

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

Gradle (Groovy DSL)

implementation 'io.github.demchaav:graph-compose:2.4.1'

Ready-made templates

One coordinate for the engine and its PDF backend, the CV, cover letter, invoice, proposal, receipt and rota templates, the bundled fonts many of them are drawn in, and colour emoji, at versions that work together.

Maven

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

Gradle (Groovy DSL)

implementation 'io.github.demchaav:graph-compose-bundle:2.4.1'

An editable PowerPoint deck Beta

Add it beside graph-compose or the bundle: the layout of the PDF, as shapes on slides.

Maven

<dependency>
  <groupId>io.github.demchaav</groupId>
  <artifactId>graph-compose-render-pptx</artifactId>
  <version>2.4.1</version>
</dependency>

Gradle (Groovy DSL)

implementation 'io.github.demchaav:graph-compose-render-pptx:2.4.1'

A Word document

Add it beside graph-compose or the bundle: a semantic export, laid out by Word itself.

Maven

<dependency>
  <groupId>io.github.demchaav</groupId>
  <artifactId>graph-compose-render-docx</artifactId>
  <version>2.4.1</version>
</dependency>

Gradle (Groovy DSL)

implementation 'io.github.demchaav:graph-compose-render-docx:2.4.1'

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();
}

One document, three kinds of file.

PDF and PowerPoint are drawn from the same resolved layout; Word receives the document's structure and lays it out itself. What each format keeps, capability by capability, is in the backend capability matrix.

PDF

graph-compose

The reference output. Fonts you register or take from the bundle are embedded and subset; the standard fonts, the default Helvetica among them, are not. Links, bookmarks and metadata are written, a document can be encrypted, and a deterministic mode renders byte-identical files.

PowerPoint Beta

graph-compose-render-pptx

Geometry-identical to the PDF, with text, panels and most vector drawing as editable shapes.

  • A clip that would cut into content, and inline SVG with clips, exact stroke styles or art outside its view box, become pictures.
  • Distinct per-corner radii, numeric dash patterns and radial gradients are approximated.
  • No encryption; the first bookmark on a slide names it, and the rest are dropped.

Word

graph-compose-render-docx

Paragraphs, tables and block images become Word content, and page zones become real headers and footers with live page numbers.

  • The text header and footer (DocumentHeaderFooter) are not written; a page zone is.
  • Shapes, lines, barcodes, inline images, links and watermarks are not written.
  • Fonts are named, not embedded, and list hanging indents are ignored.

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. PptxFixedLayoutBackend consumes the same fragments, so a deck is geometry-identical to the PDF by construction. A semantic DOCX backend maps the node tree instead, with much narrower coverage.

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

BrandTheme.modernProfessional() / .executive() / .boxedClassic() set palette, typography, table styles. Override one or all. Ships in graph-compose-templates.

Markdown-aware bodies

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

Building your own templates?

The layered architecture guide walks through the five-folder pattern — data / theme / components / widgets / presets — with a worked CV example, a widget cookbook and a contributor checklist.

All documentation · latest release v2.4.1 · Changelog