Java 17+ · v2.5.5 · 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.5.5 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.5.5</version>
</dependency>

Gradle (Groovy DSL)

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

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.5.5</version>
</dependency>

Gradle (Groovy DSL)

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

An editable PowerPoint deck

Add it beside graph-compose or the bundle: the layout of the PDF, as shapes on slides. A full output; its Java API is Experimental (@Beta).

Maven

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

Gradle (Groovy DSL)

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

A Word document

Add it beside graph-compose or the bundle: an editable document written from the laid-out page, which Word paginates. A full output; the Java API added in 2.5 is Experimental (@Beta).

Maven

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

Gradle (Groovy DSL)

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

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.

Three full outputs. PDF and PowerPoint are drawn from the same resolved layout; Word receives the document's structure with the line heights, widths and positions that layout measured, and paginates it 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

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

Written from the laid-out page: line heights and column widths, real Word lists and tables, drawings anchored to the text that carries them, charts as Word charts, page zones and headers and footers with live page numbers, links and bookmarks, and the faces the document is set in. A report names every node it could not carry.

  • Word paginates the document and reflows it after an edit, so a page can break where the PDF's does not.
  • Gradients, rotation and scale are not written, nor a watermark, protection options or viewer preferences.
  • Deterministic bytes hold on one platform; Apache POI's line separator differs across platforms.

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. DocxSemanticBackend writes the node tree as editable Word content, taking line heights, widths and where each drawing stands from the same layout, and Word paginates it.

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.5.5 · Changelog