PDF engine · CLI · HTTP API · designer

Reports and invoices from a JSON template and your data. No browser.

Liuska lays out tables, charts and page numbers itself and writes the PDF directly. It ships as one static binary, so there is no WebKit, no Chromium and no system fonts to install. A one-page report takes 19 ms from a cold CLI start.

liuska render -t template.json -d data.json -o report.pdf
Rendered sales report, page 1 of 6: KPI strip, a combo chart of monthly sales with a secondary axis, a horizontal bar chart by region, and a table with month columns, all in Finnish number format. Rendered one-page sales dashboard: four KPI boxes, a line chart by region, a stacked bar chart by channel, a donut chart and a horizontal bar chart of top products.
Real output, rendered with liuska render --png from examples/sales-report and examples/sales-dashboard.

Why not wkhtmltopdf or headless Chrome?

HTML-to-PDF means running a browser for every document

That works, but for data-driven documents most of the browser is overhead, and the parts you actually need (tables that break across pages, repeated headers, page numbers, charts) are the parts print CSS handles worst.

wkhtmltopdf

  • The GitHub repository was archived on Jan 2, 2023 and is read-only. [1]
  • It uses Qt 4's WebKit, which hasn't been updated since 2012. The project says not to use it with untrusted HTML. [2]
  • Tables across pages need thead/page-break-inside CSS that only sometimes works. Page numbers need JavaScript in separate header and footer files.

Headless Chrome (Puppeteer, Playwright)

  • A current engine with modern CSS, which is a real advantage for arbitrary HTML.
  • You install and run a browser: Puppeteer downloads Chrome for Testing, about 170 MB on macOS and 280 MB on Linux and Windows. [3]
  • Your backend still renders HTML first, then the browser lays it out again, and chart libraries have to finish drawing before you print.

Liuska

  • A template is a layout description in JSON. Data comes in as JSON or CSV. Nothing executes.
  • Tables paginate natively: the header row repeats, rows never split, totals are computed.
  • Charts are drawn as vectors by the engine. Page {{page}} of {{pages}} works in any text.
  • Not a fit if you need arbitrary HTML/CSS or long text that flows across pages. See the limits.

Speed

Milliseconds, measured with the harness in the repo

Measured on Windows with an AMD Ryzen 9 9950X (16 cores, 32 threads) using bench/. Rerun it on your own hardware with bench/run.sh or .\bench\run.ps1.

0.1 ms
1-page report, in-process with a warm engine (go test -bench)
19 ms
Same report from a cold liuska render: process start to exit, p50
~19,500/s
Renders per second from liuska serve over HTTP (p50 1.5 ms)
77 ms
10,000 rows × 8 columns, 223 pages, cold CLI
Source: README benchmark table, AMD Ryzen 9 9950X, Windows. In-process: 0.1 ms (1 page), 3.9 ms (1k rows), 39 ms (10k rows). wkhtmltopdf was not installed on that machine, so there is no side-by-side number here; the harness adds wkhtmltopdf columns when it is on PATH.
DocumentCold CLI (p50)serve, warmPDF size
1 page, ~10 text elements + 20-row table19 ms~19,500 renders/s25 KB
1,000 rows × 8 columns (23 pages)25 ms~1,950 renders/s143 KB
10,000 rows × 8 columns (223 pages)77 ms50 renders/s at c=41.2 MB

What's in the box

Everything a data-driven document needs

Every image on this page was produced by the product itself: the PDFs are the bundled examples rendered with liuska render --png, and the designer is a screenshot of liuska serve.

A designer that uses the real engine

liuska serve includes a web designer. You drag elements onto the page, bind them to data and set up tables and charts. The preview on the right is rendered by the same engine as your production PDFs, so the two can't drift apart.

  • Data panel: select an element, then click a field to bind it.
  • Problems panel lists unknown bindings and bad formats, with the element they belong to.
  • Saves plain v1 JSON. You can edit it by hand, review it in a pull request and render it with the CLI.

Today the canvas shows page 1. The preview pages through the whole document.

The Liuska designer with the sales dashboard open: a data tree on the left, the page canvas with KPI boxes and four charts in the middle, document settings, and a live preview of the rendered page on the right.
The designer with examples/sales-dashboard and its sample data loaded.

Tables that paginate themselves

Point a table at an array and pick how the columns are defined:

  • columns: fixed columns with header, width, alignment and format.
  • columnsFrom: the data supplies the columns, for example one per month in the report period.
  • autoColumns: derive columns from the rows. This works with a CSV file as-is.

The header row repeats on every page and rows are never split. totals adds a sum row, and elements anchored to the table's bottom edge follow it onto the last page.

Page 2 of the sales report: the same KPI strip as page 1 under the header, then the table continues with its dark header row repeated and month columns Tammi to Loka.
Page 2 of examples/sales-report: the header row is repeated, and the month columns come from the data.

Vector charts, no JavaScript

The chart element draws bar, line, area, pie, donut and scatter charts as vectors, so they stay sharp at any zoom and keep the PDF small.

  • Combo charts: bars and lines together, with a secondary axis.
  • Stacked and horizontal bars, data labels, legends and axis formats.
  • Series can be fixed, or come from the data with seriesFrom. Null values leave gaps.
One-page sales dashboard with a multi-series line chart, a stacked bar chart, a donut chart with percentage labels and a horizontal bar chart.
examples/sales-dashboard: four charts and four KPI boxes on one page.

Templates are JSON

A versioned format with a published JSON Schema, so VS Code validates templates and shows docs on hover. They diff cleanly in git. liuska validate catches typos in bindings and exits with code 3.

Repeating elements

Set "repeat": "all" or "following" on any element or group, such as a KPI strip, a "Confidential" stamp or a running summary. It is drawn on every page, and flowing tables make room for it.

Locales and formats

{{ total | currency:"EUR" }} and the number, percent and date filters, including localized month names.

en-US
€1,234.50
fi-FI
1 234,50 €
de-DE
1.234,50 €
sv-SE
1 234,50 €

CLI and HTTP API

render, validate, batch (NDJSON or CSV in, one PDF per record) and serve. The HTTP API renders PDFs and PNG previews, validates templates, and reports page count and render time in response headers.

One static binary

Release builds for Windows, Linux and macOS on amd64 and arm64, with cgo disabled. The designer is embedded. A default font is bundled, and the fonts you ship are subset into the PDF, so output doesn't depend on the machine.

And the rest

Header and footer bands, {{page}}/{{pages}}, images, rectangles and lines, groups and snippets, visibleIf, anchors for flowing layout, and PNG previews of any page.

Try it on the examples

Build the binary and render the sales report. Then open the same template in the designer.

# build (Go)
cd generator && go build -o ../liuska . && cd ..

# render an example
./liuska render -t examples/sales-report/template.json \
  -d examples/sales-report/data.json -o sales.pdf

# open the designer at http://127.0.0.1:8080
./liuska serve --templates examples/sales-report