Brevier in your language

The same call renders the same document in every language. Choose a language to see it.

Language

Language
import dev.brevier.Brevier;

Rechnung rechnung = rechnungen.find(id);
Kunde kunde = rechnung.getKunde();

byte[] pdf = Brevier.template("rechnung")
                    .render(rechnung, kunde);

Install

Gradle
implementation 'dev.brevier:brevier'
Maven
<artifactId>brevier</artifactId>
import brevier

rechnung = rechnungen.find(id)
kunde = rechnung.kunde

pdf: bytes = brevier.template("rechnung").render(rechnung, kunde)

Install

pip
pip install brevier
using Brevier;

var rechnung = rechnungen.Find(id);
var kunde = rechnung.Kunde;

byte[] pdf = await Brevier.Template("rechnung")
                          .RenderAsync(rechnung, kunde);

Install

.NET CLI
dotnet add package Brevier
import { Brevier } from 'brevier'

const rechnung = await rechnungen.find(id)
const kunde = rechnung.kunde

const pdf: Buffer = await Brevier.template('rechnung')
  .render({ rechnung, kunde })

Install

npm
npm install brevier

Edited in the editor you already use

A Brevier template is a set of plain files. Most IDEs highlight and check every one of them using extensions you most likely use as a developer anyway.

HTML for structure, CSS for the page, JSON Schema for the data, Markdown for simple documents, Handlebars for binding. No proprietary formats, no extra runtimes, no need for a dedicated application.

templates / rechnung

  • rechnung.htmlHTML
  • rechnung.cssCSS
  • rechnung.schema.jsonJSON Schema
  • rechnung.sample.jsonJSON
  • VS Code
  • IntelliJ IDEA
  • PyCharm
  • Visual Studio
  • WebStorm

The templates you have

Each importer reads a structured format and writes an HTML template, a stylesheet and the JSON Schema of its fields.

FromBecomesStatus
.jrxmlJasperReports report designHTML template + CSS + JSON SchemaStatus: Available
.rptdesignBIRT report designHTML template + CSS + JSON SchemaStatus: Available
.docxWord document with mail-merge fieldsHTML template + CSS + JSON SchemaStatus: Available
.pdfPDF form filled by iTextHTML template + CSS + JSON SchemaStatus: In 1.0

Untagged and scanned PDFs are not imported. Rebuilding their layout would be guesswork.

The code you have

Your Java build, or brevier.schema() in Python, reads your classes and writes their JSON Schema. Your classes stay as they are. brevier template then writes a starting template and sample data next to the schema.

1. Your build writes the schema
java -cp build/classes:brevier-codegen.jar dev.brevier.codegen.SchemaGeneratorCommand --root rechnung=com.muster.Rechnung > rechnung.schema.json
2. Brevier writes the template
brevier template --schema rechnung.schema.json
Your class, unchanged
public class Rechnung {
  private String nummer;
  private LocalDate datum;
  private List<Position> positionen;
  private BigDecimal summe;
  // getters, unchanged
}
The schema Brevier writes, shortened
{
  "type": "object",
  "properties": {
    "rechnung": { "$ref": "#/$defs/Rechnung" }
  },
  "$defs": {
    "Rechnung": {
      "type": "object",
      "properties": {
        "nummer":     { "type": "string" },
        "datum":      { "type": "string", "format": "date" },
        "positionen": { "type": "array",
                        "items": { "$ref": "#/$defs/Position" } },
        "summe":      { "type": "number", "format": "decimal" }
      }
    }
  }
}

Status: Available

Install Brevier

It runs on your laptop, offline, with no account and no server.

Brevier stops without a licence key, also for testing. Get the key before the first render. Get a free 30-day trial key

Choose how to install

For Python 3 users. pip needs the Pango library on your system.

  1. Install Brevier
    pip install brevier
  2. Check that it works
    brevier --version
  3. Set your key
    export BREVIER_LICENCE_KEY="<your-licence-key>"
  4. Render the sample invoice
    brevier pdf rechnung.html --data rechnung.json -o rechnung.pdf

The script installs Brevier in its own folder and puts the Brevier command in ~/.local/bin. On macOS it also installs Pango.

  1. Install Brevier
    curl -fsSL https://get.brevier.dev | bash
  2. Check that it works
    brevier --version
  3. Set your key
    export BREVIER_LICENCE_KEY="<your-licence-key>"
  4. Render the sample invoice
    brevier pdf rechnung.html --data rechnung.json -o rechnung.pdf

The PowerShell script installs Pango through MSYS2, then installs Brevier for your user and adds it to your PATH.

  1. Install Brevier
    irm https://get.brevier.dev/ps | iex
  2. Check that it works
    brevier --version
  3. Set your key
    $env:BREVIER_LICENCE_KEY = "<your-licence-key>"
  4. Render the sample invoice
    brevier pdf rechnung.html --data rechnung.json -o rechnung.pdf

Nothing to install on the machine but Docker. The image runs Brevier in the folder you mount at /work.

  1. Install Brevier
    docker pull brevier/brevier:latest
  2. Check that it works
    docker run --rm brevier/brevier --version
  3. Set your key
    export BREVIER_LICENCE_KEY="<your-licence-key>"
  4. Render the sample invoice
    docker run --rm -v "$PWD:/work" -e BREVIER_LICENCE_KEY="$BREVIER_LICENCE_KEY" brevier/brevier pdf rechnung.html --data rechnung.json -o rechnung.pdf