Command-line renderer
@rd/server includes rd-render, which renders PDFs in-process without starting a server. Use it for scripts, cron jobs, CI tests of templates and one-off
batches.
npx rd-render --template bol.template.json --data bol.data.json --out bol.pdf
Output: Wrote /…/bol.pdf: 3 page(s), 90561 bytes, 0 warning(s), no watermark with a valid license. Without one, the PDF is still written and the
summary ends in watermark TRIAL, watermark EXPIRED or watermark UNLICENSED. An expired, missing or invalid license also prints one license: line
that says what to do (for a key that was not accepted, a second reason: line says why) (License).
| Option | Meaning |
|---|---|
--template <file> | Template JSON (required) |
--data <file> | Data JSON (default {}) |
--out <file> | Output PDF (required) |
--records | The data file is a JSON array: render one copy of the document per item into one PDF |
--locale <tag> | Number and date locale (overrides the template's document language) |
--now <iso> | Fixed "now" for {{ now }}, for deterministic output |
--font-dir <dir> | Extra fonts, same as RD_FONT_DIR |
--license-file <file> | File that holds the license key, same as LICENSE_FILE |
-h, --help | Show help |
Environment variables such as LICENSE_KEY, LICENSE_FILE, RD_MAX_PAGES and RD_IMAGE_URL_ALLOWLIST apply as for the server (Configuration).
Render a batch from a JSON array:
node -e "process.stdout.write(JSON.stringify(require('./bol-batch.data.json').shipments))" > bols.json
npx rd-render --template bol.template.json --data bols.json --records --out all-bols.pdf
The exit code is non-zero when the template is invalid or rendering fails, so the CLI fits CI pipelines: render every template in your repository with its sample data, and fail the build on errors. Licensing never changes the exit code: without a valid license the PDF is written, watermarked, and the exit code is 0.