GraphCompose Templates

August 4, 2026 · View on GitHub

io.github.demchaav:graph-compose-templates

The built-in CV, cover-letter, invoice, and proposal document templates (com.demcha.compose.document.templates.**). Pure authoring code over the canonical DSL — no engine internals, no PDFBox — so it depends only on graph-compose-core.

When to depend on it

Add it when you want the ready-made presets. It is opt-in: neither the graph-compose wrapper nor graph-compose-core bundles it (graph-compose-bundle does). A 1.x caller that reached a preset through the single jar must add this artifact — the packages are unchanged.

Not sufficient on its own. This artifact depends only on graph-compose-core, and opening a DocumentSession resolves a FontMetricsProvider — which only graph-compose-render-pdf publishes. Without it create() fails with MissingBackendException before a preset ever composes. Add graph-compose-render-pdf, or depend on graph-compose.

Smallest complete example

Each preset is a final class with a create(BrandTheme) factory returning a DocumentTemplate<S>. A preset composes into an open session; it never renders — the caller does:

Path out = Path.of("invoice.pdf");
try (DocumentSession doc = GraphCompose.document(out).create()) {
    ModernInvoice.create(theme).compose(doc, invoiceSpec);
    doc.buildPdf();                 // -> invoice.pdf
}

Families: cv, coverletter, invoice, proposal — each a layered stack (data / components / widgets / presets) over the shared core layer (BrandTheme, identity, text, widgets). See the layered-template guides.

Install

Same version as the rest of the GraphCompose train (lockstep):

<dependency>
    <groupId>io.github.demchaav</groupId>
    <artifactId>graph-compose-templates</artifactId>
    <version>2.1.1</version>
</dependency>
dependencies { implementation("io.github.demchaav:graph-compose-templates:2.1.1") }

The full "which artifact?" table: root README → Installation. Upgrading from 1.x: modules migration guide.