Brevier in your language
The same call renders the same document in every language. Choose a language to see it.
Language
import dev.brevier.Brevier;
Rechnung rechnung = rechnungen.find(id);
Kunde kunde = rechnung.getKunde();
byte[] pdf = Brevier.template("rechnung")
.render(rechnung, kunde);Install
implementation 'dev.brevier:brevier'<artifactId>brevier</artifactId>import brevier
rechnung = rechnungen.find(id)
kunde = rechnung.kunde
pdf: bytes = brevier.template("rechnung").render(rechnung, kunde)Install
pip install brevierusing Brevier;
var rechnung = rechnungen.Find(id);
var kunde = rechnung.Kunde;
byte[] pdf = await Brevier.Template("rechnung")
.RenderAsync(rechnung, kunde);Install
dotnet add package Brevierimport { 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 install brevierEdited 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.htmlHTMLrechnung.cssCSSrechnung.schema.jsonJSON Schemarechnung.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.
| From | Becomes | Status |
|---|---|---|
.jrxmlJasperReports report design | HTML template + CSS + JSON Schema | Status: Available |
.rptdesignBIRT report design | HTML template + CSS + JSON Schema | Status: Available |
.docxWord document with mail-merge fields | HTML template + CSS + JSON Schema | Status: Available |
.pdfPDF form filled by iText | HTML template + CSS + JSON Schema | Status: 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.
java -cp build/classes:brevier-codegen.jar dev.brevier.codegen.SchemaGeneratorCommand --root rechnung=com.muster.Rechnung > rechnung.schema.jsonbrevier template --schema rechnung.schema.jsonpublic class Rechnung {
private String nummer;
private LocalDate datum;
private List<Position> positionen;
private BigDecimal summe;
// getters, unchanged
}{
"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
For Python 3 users. pip needs the Pango library on your system.
- Install Brevier
pip install brevier - Check that it works
brevier --version - Set your key
export BREVIER_LICENCE_KEY="<your-licence-key>" - 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.
- Install Brevier
curl -fsSL https://get.brevier.dev | bash - Check that it works
brevier --version - Set your key
export BREVIER_LICENCE_KEY="<your-licence-key>" - 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.
- Install Brevier
irm https://get.brevier.dev/ps | iex - Check that it works
brevier --version - Set your key
$env:BREVIER_LICENCE_KEY = "<your-licence-key>" - 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.
- Install Brevier
docker pull brevier/brevier:latest - Check that it works
docker run --rm brevier/brevier --version - Set your key
export BREVIER_LICENCE_KEY="<your-licence-key>" - 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