Rendering
Languages and locales
Send a locale with a render and DevilPDF takes care of the rest: the right fonts, the reading direction, money and dates in the local format, and translated labels on the starter templates.
curl https://devilpdf.com/v1/render \
-H "Authorization: Bearer $DEVILPDF_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "invoice",
"locale": "de-DE",
"data": { "currency": "EUR", "number": "RE-2041", "items": [{ "name": "Beratung", "quantity": 3, "unit_price": 1234.56 }] }
}'That invoice says *Rechnung*, *Zwischensumme* and *Gesamt*, and prints 3.703,68 €.
#The locale field
locale is a language tag such as en-US, fr-CA, pt-BR, ja-JP or ar. It is a top-level field on POST /v1/render and on every item of a batch. You can also set it once in a template's settings, or pass it inside data.
| What it changes | Example for fr-FR |
|---|---|
money filter | 1 234,56 € |
number filter | 1 234,56 |
local_date filter | 2 déc. 2026 |
t filter (labels) | Facture, Sous-total |
| Text direction | Left to right. ar, he, fa and ur turn the page right to left |
The document's lang attribute | fr-FR, which sets hyphenation and line breaking |
An unknown tag returns a 400 that says so. A missing locale means en-US.
#Fonts for every script
No character renders as an empty box. DevilPDF looks at the finished document and loads the fonts it needs, and only those:
| Script | Font |
|---|---|
| Latin, Cyrillic, Greek, Vietnamese | Inter |
| Arabic, Persian, Urdu | Noto Sans Arabic |
| Hebrew | Noto Sans Hebrew |
| Chinese (Simplified, Traditional), Japanese, Korean | Noto Sans SC, TC, JP, KR |
| Hindi, Marathi, Nepali | Noto Sans Devanagari |
| Bengali, Tamil, Telugu, Gujarati, Punjabi, Kannada, Malayalam, Sinhala | Noto Sans, one per script |
| Thai, Lao, Khmer, Burmese | Noto Sans, one per script |
| Georgian, Armenian, Amharic | Noto Sans, one per script |
| Emoji | Noto Color Emoji |
Chinese, Japanese and Korean share many characters that are drawn differently in each region. The locale decides which drawing you get: ja picks the Japanese forms, zh-TW the Traditional ones, ko the Korean ones. Without a locale DevilPDF guesses from the text.
This works in templates and in raw HTML sent with "options": { "kit": true }. If you set your own font-family in CSS, add the fallback list to the end of it so other scripts still find a font:
.title { font-family: "Georgia", var(--font-fallback), serif; }A complete HTML document (one with its own <html> tag) is passed to the browser untouched, so there you load your own fonts.
#Right-to-left documents
For Arabic, Hebrew, Persian and Urdu the whole page mirrors: the logo moves to the right, table columns run right to left, totals sit on the left, and page numbers swap sides. You do not write a second template.
It works because the print kit is built on direction-neutral CSS. Do the same in your own CSS and your template mirrors for free:
| Instead of | Write |
|---|---|
text-align: left / right | text-align: start / end |
margin-left, padding-right | margin-inline-start, padding-inline-end |
border-left | border-inline-start |
Amounts, dates and reference numbers keep their own reading order inside a right-to-left page, so INV-2041 never comes out backwards. Add class="bidi" to any element of your own that holds a number, code or mixed-direction value.
To force a direction whatever the locale, send "direction": "rtl" or "direction": "ltr".
Arabic locales print Arabic-Indic digits (١٢٣) where that is the local default, for example ar-SA and ar-EG. For Western digits (123) add the numbering extension: "locale": "ar-SA-u-nu-latn".
#Money, numbers and dates
{{ total | money }} {# uses "currency" and "locale" from the request #}
{{ total | money: "EUR" }} {# a fixed currency #}
{{ quantity | number: 2 }} {# two decimals, local separators #}
{{ issue_date | local_date }} {# Dec 2, 2026 · 2 déc. 2026 · 2026/12/02 #}
{{ issue_date | local_date: "long" }}local_date styles: short, medium (the default), long, full, day (month and day) and month (month and year). Dates print as written: 2026-12-02 is the 2nd of December whatever time zone we render in.
locale | {{ 1234.56 | money }} | {{ "2026-12-02" | local_date }} |
|---|---|---|
en-US, currency USD | $1,234.56 | Dec 2, 2026 |
en-CA, currency CAD | $1,234.56 | Dec 2, 2026 |
fr-CA, currency CAD | 1 234,56 $ | 2 déc. 2026 |
de-DE, currency EUR | 1.234,56 € | 02.12.2026 |
ja-JP, currency JPY | ¥1,235 | 2026/12/02 |
hi-IN, currency INR | ₹1,234.56 | 2 दिस॰ 2026 |
#Translated labels
The seven starter templates are translated into these languages. Send the locale and the labels follow:
Arabic, Bengali, Chinese (Simplified and Traditional), Czech, Danish, Dutch, Finnish, French, German, Greek, Hebrew, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish, Tamil, Thai, Turkish, Ukrainian, Urdu and Vietnamese.
In your own templates, mark a label with the t filter. The English text is the key:
<th>{{ "Description" | t }}</th>
<th class="num">{{ "Unit price" | t }}</th>If we have no translation for a phrase or a language, the English prints. To supply your own words, in any language, send a labels object. It wins over ours:
{
"template": "invoice",
"locale": "fr-CA",
"data": {
"labels": { "Invoice": "Facture fiscale", "Tax": "TPS/TVH" }
}
}Tax names differ by country, so the starters take one from your data: set tax_label to HST, GST, VAT, IVA, MwSt. or whatever your invoice must say.