Reference
Command line
Every brevier command and its options: pdf, html, preview, lint, serve, import, batch, compile, template, scaffold, sample, from-template and licence.
On this page
brevier --version
brevier --help
brevier <command> --help| Command | What it does |
|---|---|
pdf |
Renders one template to a PDF. |
html |
Renders one template to HTML. |
preview |
Previews a template in the browser and reloads on save. |
lint |
Renders a template and lists the layout and font problems, each with its page and the line of the generated HTML. |
serve |
Runs the engine as an HTTP service or stdio process. |
import |
Imports a template from Word, JasperReports or BIRT. |
batch pdf, batch html |
Renders every template in a folder. |
compile |
Writes the HTML that a Markdown template compiles to. |
template |
Writes a starting template and sample data from a schema. |
scaffold |
Writes a schema, a starting template and sample data from one JSON record. |
sample |
Writes sample data from a schema, and nothing else. |
from-template |
Writes the schema a template needs. |
licence |
Shows the company, type, key ID, end date and days left of your licence key. |
Renders one HTML or Markdown template to a PDF.
brevier pdf rechnung.md --data rechnung.json -o rechnung.pdf| Option | Meaning |
|---|---|
-o, --output |
The file to write. Required. |
--data |
A JSON file with the data. |
--theme |
A built-in theme: print-base, web or din5008. |
--style |
A CSS file. Use it more than once for several files; a later file wins. |
--schema |
The schema check: true (the default, uses rechnung.schema.json next to the template), false, the path of a schema file, or the schema as JSON text. |
--base-url |
The folder or URL that images and fonts with a relative path are read from. Default: the template's folder. |
--debug |
Also write the HTML and CSS the engine got, as .debug.html and .debug.css. |
--einvoice |
Also embed the invoice as data, in the file factur-x.xml (ZUGFeRD / Factur-X). See below. |
The command ends with exit code 1 when something is wrong: broken JSON, a missing field, a schema error, or a missing CSS file. The message says what is wrong and, where it can, on which line.
E-invoice
Every PDF that Brevier writes is PDF/A-3b. With --einvoice, the PDF also
carries the invoice as an XML file in the EN 16931 standard, so the buyer's
software can book it without typing.
brevier pdf rechnung-zugferd.html --data rechnung.json --einvoice -o rechnung.pdfBrevier writes the XML from the same --data as the page. The data must
follow the invoice schema. Before it writes the file, Brevier checks that
the amounts add up. If they do not, the command stops and names the field.
The template rechnung-zugferd shows a full invoice.
html
Renders one template to HTML, with the same options as pdf except
--einvoice. The HTML is
product output: see Output and tests.
brevier html rechnung.md --data rechnung.json -o rechnung.htmlpreview
Previews a template in the browser and reloads automatically whenever the template, data or stylesheet changes on disk.
brevier preview rechnung.html --data rechnung.json --port 5151 --open| Option | Meaning |
|---|---|
<template_file> |
Input HTML or Markdown template file. Required. |
--data |
JSON data file to bind into the template. Default: sample.json next to the template if present. |
--style, --css |
Additional CSS stylesheets to apply. Use it more than once for several files. |
--theme |
A built-in theme: print-base, web or din5008. |
--port |
Port to listen on. Default: 5151. |
--open, --no-open |
Open the browser when the preview starts, or not. Default: --no-open. |
lint
Renders a template and lists the problems on the pages: text wider than its
container (overflow), a table column narrower than its declared minimum width
(table), a glyph that the font lacks (glyph), a heading alone at the bottom of
a page (orphan), a table row broken across pages (split) and hyphenated lines
that break the hyphen rules (hyphens). It writes no PDF. A column declares its
minimum with data-min-width on its <col>: see the lint guide.
brevier lint rechnung.html --data rechnung.json --debug-dir out/Each problem has one line: the page, the kind, what is wrong, and → the
file and line of the generated HTML that holds the cause.
rechnung.html
page 2 overflow "DE893704004405320130…" wider than its box (106.1 > 38.4 mm) → out/rechnung.debug.html:412
→ 1 problem. exit code 1
debug file: out/rechnung.debug.html (holds the document's data)| Option | Meaning |
|---|---|
<input_file> |
The .html or .md template. Required. |
--data |
A JSON file with the data. |
--theme |
A built-in theme: print-base, web or din5008. |
--style |
A CSS file. Use it more than once for several files; a later file wins. |
--debug-dir |
The folder for the generated HTML. Default: the folder of the template. |
--schema |
The schema check of the data: true (the default, uses <stem>.schema.json), false, the path of a schema file, or the schema as JSON text. |
--format |
text (default) or json. With json, the output is an array with one object per problem, with the keys page, kind, message, file and line. |
The command always writes rechnung.debug.html and rechnung.debug.css,
because a problem without the file does not say where it is. The files hold
the data of the document: do not share them if the data is private.
Exit code 0: no problems. Exit code 1: at least one problem, or a template that
cannot be rendered. Exit code 2: a wrong file type or --format.
serve
Runs the engine as an HTTP microservice or stdio process. Client libraries connect to this service in production.
brevier serve --templates templates/ --port 8080| Option | Meaning |
|---|---|
--templates |
Folder whose sub-folders are templates, each as <name>/<name>.html or .md. Required. |
--host |
Listen address. The default accepts only this machine. The server has no TLS and no login: put a gateway in front of it before you expose it. Default: 127.0.0.1. |
--port |
Port to listen on. Default: 8080. |
--allowed-host |
A host name, besides this machine, that a request may use in its Host header. Give it for the name a gateway or a container network uses. Can be repeated. Any other name gets 403. |
--stdio |
Read one JSON request per line from standard input and write one answer per line to standard output. |
import
Imports an existing template from Word (.docx), JasperReports (.jrxml) or BIRT (.rptdesign), creating an HTML template, a CSS stylesheet and a JSON Schema. A .jrxml or .rptdesign import also writes sample.json. For each element it leaves out, it prints a line Not converted: line N: <element>. Import a template lists what it converts and names.
brevier import brief.docx -o templates/brief| Option | Meaning |
|---|---|
<input_file> |
Input Word, JasperReports or BIRT file to import. Required. A .pdf file is accepted, but no file is written: the AcroForm import is planned. |
-o, --output |
Output directory for generated templates and schemas. |
--force |
Overwrite template files that exist. An import refuses to by default. |
batch
Renders every template in a folder and its subfolders.
brevier batch pdf templates/ -o out/
brevier batch html templates/ -o out/ --pattern "*.md"For each template, Brevier uses a JSON file with the same name as data, if
there is one: rechnung.html and rechnung.json give out/rechnung.pdf.
The output keeps the folder structure.
| Option | Meaning |
|---|---|
-o, --output |
The output folder. Required. |
--pattern |
Which files are templates. Default: *.html. |
--debug |
As for pdf. |
compile
Writes the HTML that a Markdown template compiles to, next to it. See Templates.
brevier compile rechnung.md| Option | Meaning |
|---|---|
--force |
Replace the HTML file if it exists. |
template
Writes a starting template, a stylesheet and sample data from a schema. See Schema and code.
brevier template --schema rechnung.schema.json| Option | Meaning |
|---|---|
--schema |
The schema file. Required. Its name before .schema.json names the files. |
--format |
html (default) or md. |
--theme |
The theme the template names. Default: print-base. |
--force |
Replace files that exist. |
scaffold
Writes a schema, a starting template and sample data from one JSON record, for example a real invoice from your system.
brevier scaffold --from rechnung.json| Option | Meaning |
|---|---|
--from |
The JSON file with one record. Required. |
--name |
The base name of the files. Default: the name of the --from file. |
--format |
html (default) or md. |
--theme |
The theme the template names. Default: print-base. |
--force |
Replace files that exist. |
It writes rechnung.schema.json, rechnung.html, rechnung.css and
sample.json.
sample
Writes sample data from a schema. It writes no template and no stylesheet, and changes none.
brevier sample --schema rechnung.schema.json| Option | Meaning |
|---|---|
--schema |
The schema file. Required. |
-o, --output |
The file to write. Default: sample.json next to the schema. |
--force |
Replace the file if it exists. |
from-template
Writes the schema that a template needs, from the {{ }} tags in it.
brevier from-template police.html| Option | Meaning |
|---|---|
--lang |
Also write Java classes, sample.json and an example: java8 or java17. |
--package |
With --lang: the Java package, for example com.acme.police. |
--force |
Replace files that exist. |
licence
Shows the licence key that Brevier reads from BREVIER_LICENCE_KEY: the company,
the type (production or trial), the key ID, the end date and the days left.
It works without a key. For a missing, invalid or ended key it prints the reason and
exits with code 1.
brevier licenceEvery other command except --help and --version stops with exit code 1 and writes
no file unless the key is valid. Get a 30-day trial key at
brevier.dev/pricing.