Stream straight into HTTP responses
session.writePdf(OutputStream) writes incrementally with no in-memory buffering. Spring Boot, Quarkus, Micronaut, or plain Java HTTP.
Java · v2.1.1 · MIT
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.
The same resolved layout also renders to an editable PowerPoint deck — one page per slide, geometry-identical to the PDF, text and panels as native shapes. Opt in with graph-compose-render-pptx (@Beta).
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.
The whole stack — theme tokens, table, totals, chrome — behind one fluent DSL.
Tables split row-by-row, rows are atomic, layer stacks atomic. No manual page math.
Every preset is one final class with a one-liner create(BrandTheme) factory.
A full-reactor verify gate on every push: layout snapshots per preset, pixel-diff visual parity, public-API leak guards.
Install
<dependency>
<groupId>io.github.demchaav</groupId>
<artifactId>graph-compose</artifactId>
<version>2.1.1</version>
</dependency>
dependencies {
implementation(
'io.github.demchaav:graph-compose:2.1.1'
)
}
try (var doc = GraphCompose
.document(out).create()) {
doc.pageFlow()
.addParagraph("Hello, GraphCompose")
.addList(l -> l.items(
"PDF", "DOCX", "Tables"))
.build();
doc.buildPdf();
}
Showcase
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...
Architecture
ParagraphNode, TableNode, SectionNode, LayerStackNode, CanvasLayerNode.LayoutGraph — geometry only, no draw calls.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.Why GraphCompose
session.writePdf(OutputStream) writes incrementally with no in-memory buffering. Spring Boot, Quarkus, Micronaut, or plain Java HTTP.
Every preset has a layout-graph JSON baseline plus a pixel-diff visual parity baseline. Regressions surface on the first run.
BrandTheme.modernProfessional() / .executive() / .boxedClassic() set palette, typography, table styles. Override one or all. Ships in graph-compose-templates.
Inline **bold**, *italic*, _italic_ markers parsed in every paragraph and list block automatically.