Skip to content

Latest commit

 

History

History
96 lines (78 loc) · 5.27 KB

File metadata and controls

96 lines (78 loc) · 5.27 KB

Recipes

GraphCompose recipes are split into focused pages so each page covers one topic end-to-end. All recipes use only the canonical session-first authoring API; public application code should not import com.demcha.compose.engine.*.

Topic-focused recipe pages

Page Covers
Charts Native vector bar / line / area / pie-donut charts: data–spec–style layers, axis & grid toggles, point markers, value-label halos, legend placement, translucent area fills
Keep-together pagination keepTogether() / keepEntriesTogether() — blocks that relocate whole instead of orphaning a heading at a page break
Themes BusinessTheme.classic / modern / executive, page background, palette slots, text scale, the CvThemeBusinessTheme bridge
Shapes and visual primitives Filled cards, dividers, spacers, lines, ellipses, image fit modes, soft panels
Shape-as-container addCircle / addEllipse / addContainer with ClipPolicy (clipped layered children)
Transforms and z-index rotate / scale mixin, per-layer zIndex for overlays
Page backgrounds pageBackground / pageBackgrounds, PageBackgroundFill columns, bands, point-based fills, layering
Layered page design Choosing between page backgrounds, rows, layer stacks, and canvases
Absolute placement addCanvas + position(x, y) for pixel-precise certificates and badges
Tables Row span, zebra rows, totals row, repeated header on page break
Rich text RichText mixed-style runs, inline links/images/shapes, SVG icons, emoji shortcodes, checkboxes
Lists addList, marker customisation, nested lists with per-depth markers
Timelines addTimeline: markers on a connector rail, geometry and text-style controls
Barcodes QR / Code 128 / EAN / UPC and friends, tinting, quiet zone
Images Sources, sizing precedence, fit modes, images in rows and cards
PDF chrome Metadata, watermarks, running header/footer placeholders, protection, links, bookmarks
In-PDF navigation Anchors + internal linkTo links: clickable contents, heading jumps, bidirectional footnotes, inline-graphic links
Translucency DocumentColor.rgba / withOpacity, alpha coverage, layered tints
DOCX export Semantic export, node mapping, fallbacks and skipped kinds
Snapshot testing Layout-snapshot regression testing in consumer projects
Streaming and output buildPdf / writePdf / toPdfBytes, DOCX export, layout snapshots, header / footer chrome, guide lines
Extending GraphCompose New semantic node, fluent setter, render backend, snapshot-based regression tests

For longer-form material:

Common DSL primitives — quick snippets

The following snippets cover the three smallest "I just want to put text on a page" patterns. Use them as starting points before reaching for a focused recipe page.

Paragraph module

document.pageFlow(page -> page
        .module("Professional Summary", module -> module.paragraph(
                "Backend engineer focused on secure Java systems and reliable document generation.")));

Bullet list

document.pageFlow(page -> page
        .module("Technical Skills", module -> module.bullets(
                "Java 21",
                "Spring Boot",
                "PostgreSQL",
                "Docker")));

Markerless rows

document.pageFlow(page -> page
        .module("Projects", module -> module.rows(
                "GraphCompose - Declarative PDF/document layout engine.",
                "CVRewriter - Profile-aware CV tailoring platform.")));

Snapshot regression in a test

import com.demcha.compose.testing.layout.LayoutSnapshotAssertions;

try (DocumentSession document = GraphCompose.document().create()) {
    document.pageFlow(page -> page
            .module("Snapshot Example", module -> module.paragraph("Hello GraphCompose")));

    LayoutSnapshotAssertions.assertMatches(document, "my-feature/hello");
}

See recipes/extending.md § 4 for the full snapshot workflow including baseline approval.