⚠️ Early Development Stage - This project is in active early development. APIs may change, and some features are still being implemented and optimized.
Data-driven report generation with Typst as embedded render engine.
Build professional PDF reports without learning Typst. Use components, themes, and template packs to create reports from structured data.
- Component-based: Build reports using pre-built components (ScoreCard, Finding, Table, etc.)
- Theme Tokens: CSS-variable-like theming system for consistent styling
- Template Packs: Extend with custom templates and components
- Embedded Typst: No CLI dependency, Typst runs as a library
- Type-safe: Full Rust API with compile-time guarantees
use renderreport::prelude::*;fnmain() -> renderreport::Result<()>{let engine = Engine::new()?;let report = engine
.report("default").title("My Report").add_component(ScoreCard::new("Quality",95)).add_component(Finding::new("Issue Found",Severity::Medium,"Description of the issue")).build();let pdf = engine.render_pdf(&report)?;
std::fs::write("report.pdf", pdf)?;Ok(())}Add to your Cargo.toml:
[dependencies]
renderreport = "0.3"Engine::render_typ() returns the intermediate .typ source that would
be compiled to PDF. Useful for snapshot tests, custom lint/format
pipelines (e.g. typstyle), or downstream tooling that wants to
post-process the source before compilation.
let source:String = engine.render_typ(&report)?;
std::fs::write("report.typ",&source)?;59+ production-ready components organized into 8 semantic categories:
- Layout & Structure — Section, Grid, Columns, FlowGroup, PageBreak
- Text & Editorial — TextBlock, Label, Eyebrow
- Metrics & KPIs — ScoreCard, Gauge, BigNumber, TrendTile, ProgressBar
- Data & Comparison — AuditTable, ComparisonBlock, Crosstab, PivotTable
- Narrative & Storytelling — Finding, QuoteBlock, WhyItMatters, ProblemSolution, BeforeAfter
- Infographics — ProcessFlow, Timeline, Funnel, RoadmapBlock, PhaseBlock, WordSearch
- Marketing & Sales — ProductHero, FeatureGrid, BenefitStrip, CTABox, PricingCard, Testimonial, UseCaseCard
- Media & Assets — Image, Barcode, Sparkline, Chart, List, FaqList, GlossaryList
→ See COMPONENTS.md for complete reference with examples.
Pre-configured report structures for common use cases:
- AuditPattern — Security/compliance audits (findings, impact, roadmap, CTA)
- MarketingPattern — Product showcases (hero, features, comparison, testimonials, pricing)
- ExecutivePattern — C-level summaries (metrics, top findings, recommendation, timeline)
|
Divider| Horizontal separator line | BIRT Band Elements | |Watermark| Background watermark text | Pentaho Watermark | |PageBreak| Force page break | BIRT Page Setup |
Visualize data with comprehensive chart types inspired by JasperReports Chart Components:
| Component | Description | Chart Types |
|---|---|---|
Chart | Full-featured charts | Bar, Line, Pie, Area, Scatter, Radar |
Sparkline | Inline mini-charts | Line, Bar |
Gauge | Progress/metric meters | Circular, Thermometer, Horizontal |
Complex data aggregation inspired by BIRT Cross Tabs and JasperReports Crosstabs:
| Component | Description | Use Case |
|---|---|---|
Crosstab | Dynamic pivot table with aggregation | Sales by Region × Product |
PivotTable | Pre-aggregated pivot display | Summary reports |
Generate barcodes in multiple formats (inspired by JasperReports Barcode and Pentaho):
| Component | Formats Supported |
|---|---|
Barcode | Code128, Code39, EAN-13, EAN-8, UPC-A, UPC-E, QR Code, Data Matrix, PDF417, ITF, Codabar |
Simple text display inspired by BIRT and Pentaho field elements:
| Component | Description | Example Use |
|---|---|---|
Label | Simple styled text | Headings, captions |
Text | Multi-line text block | Paragraphs, descriptions |
NumberField | Formatted numbers | Currency: $1,234.56, Percentage: 87.5% |
DateField | Formatted dates | 2024-03-15, 15.03.2024, 03/15/2024 |
ResourceField | Localized strings | i18n support |
use renderreport::theme::{Theme,TokenValue};letmut theme = Theme::new("brand","Brand Theme");
theme.tokens.set("color.primary",TokenValue::Color("#1a56db".into()));
theme.tokens.set("color.ok",TokenValue::Color("#059669".into()));let report = engine.report("default").theme(theme)// ...See docs/CONVENTIONS.md for all available tokens.
Load external packs for specialized reports:
engine.load_pack("seo-audit")?;let report = engine
.report("seo-audit").pack("seo-audit")// ...Create your own packs with custom templates and components. See @casoon/renderreport-packs.
Enable the wasm feature to compile the engine to wasm32-unknown-unknown and
run it inside a JS host with no filesystem or system fonts available (e.g. a
Cloudflare Worker). Fonts are embedded in the binary as a fallback
(EngineConfig::use_embedded_fonts) and picked up automatically whenever no
system/font-path fonts are present.
[dependencies]
renderreport = { version = "0.3", default-features = false, features = ["wasm"] }cargo build --release --target wasm32-unknown-unknown --no-default-features --features wasm
wasm-bindgen target/wasm32-unknown-unknown/release/renderreport.wasm --out-dir pkg --target webimport{initSync,render,render_wordsearch}from"./pkg/renderreport.js";importwasmModulefrom"./pkg/renderreport_bg.wasm";// bundler-provided WebAssembly.ModuleinitSync({module: wasmModule});// Generic report from a RenderRequestconstpdfBytes=render(JSON.stringify(renderRequest));// Purpose-built word search puzzle: title/explanation page, puzzle, solution —// the grid itself is always computed by the real WordSearch engineconstwordSearchPdf=render_wordsearch(JSON.stringify({title: "Animals",words: ["CAT","DOG","OWL"],translations: ["Katze","Hund",null],// optional, per wordlanguage: "en",// "de" | "en" | "fr" | "es"}));The barcodes feature (Code128/QR/DataMatrix/…) is on by default for native
use; disable it with default-features = false on targets where the extra
dependency weight isn't needed (as in the wasm example above).
renderreport/
├── src/
│ ├── lib.rs # Main library entry
│ ├── engine/ # Core rendering engine
│ ├── components/ # Standard components
│ ├── theme/ # Theme & token system
│ ├── pack/ # Pack loading system
│ ├── render/ # Typst compilation
│ └── vfs/ # Virtual filesystem
├── templates/ # Built-in Typst templates
├── packs/ # Bundled template packs
├── examples/ # Usage examples
└── docs/ # Documentation
- Core engine with Typst integration
- Standard component library
- Theme token system
- Basic pack loading
- Full test coverage
- Pack validation & versioning
- Remote pack loading
- Pack registry
- Preview server for development
- Visual regression tests
- HTML output (experimental)
- WASM support
- @casoon/renderreport-packs - Official template packs
- @casoon/renderreport-examples - Demo applications
MIT