SVG templates
An SVG template is a page drawn in a design tool, with the Twig language written into its text. Doxtly fills it in with each document’s data and prints it as a PDF. Choose SVG when the design is the point: a training company’s course certificate, a gift voucher, an invoice in your brand’s layout. For text that runs over several pages, a Word template is the better tool.
Available when: your plan includes SVG templates (Starter or higher)
A first template
Section titled “A first template”Here is the whole idea in one certificate for Northbridge Advisory’s courses.
<svg xmlns="http://www.w3.org/2000/svg" width="595" height="842" viewBox="0 0 595 842"> <rect width="595" height="842" fill="#1F3A5F"/> <path d="M42 20H553A22 22 0 0 0 575 42V800A22 22 0 0 0 553 822H42A22 22 0 0 0 20 800V42A22 22 0 0 0 42 20Z" fill="#FBF7EC"/> <path d="M52 32H543A20 20 0 0 0 563 52V790A20 20 0 0 0 543 810H52A20 20 0 0 0 32 790V52A20 20 0 0 0 52 32Z" fill="none" stroke="#B8944F" stroke-width="1.4"/> <g transform="translate(214 70)"> <rect width="44" height="44" rx="9" fill="#1F3A5F"/> <path d="M11 33V11h4l14 15V11h4v22h-4L15 18v15z" fill="#fff"/> <text x="54" y="21" font-family="Arial, sans-serif" font-size="19" font-weight="700" fill="#1F3A5F">Northbridge</text> <text x="54" y="39" font-family="Arial, sans-serif" font-size="13" fill="#5B6773">Advisory</text> </g> <g text-anchor="middle" fill="#1F3A5F" font-family="Noto Serif Display, serif"> <text x="297.5" y="206" font-size="66">Certificate</text> <text x="297.5" y="238" font-size="13" letter-spacing="6" fill="#9A7A3A" font-family="Noto Sans, sans-serif">OF COMPLETION</text> <text x="297.5" y="306" font-size="9.5" letter-spacing="3" fill="#5B6773" font-family="Noto Sans, sans-serif">THIS IS TO CERTIFY THAT</text> <text x="297.5" y="364" font-size="46" font-style="italic">{{ participant.name }}</text> <text x="297.5" y="424" font-size="14" fill="#3F4A56" font-family="Noto Serif, serif">has successfully completed the course</text> <text x="297.5" y="464" font-size="27" font-weight="700">{{ course.title }}</text> <text x="297.5" y="498" font-size="14" fill="#3F4A56" font-family="Noto Serif, serif">on {{ formatdate(course.date, 'd MMMM yyyy') }}</text> {% if score >= 90 %} <text x="297.5" y="536" font-size="19" font-style="italic" fill="#9A7A3A">with distinction</text> {% endif %} </g> <path d="M110 382H485M190 258H405" stroke="#B8944F" stroke-width=".8"/> <image href="{{ qrcode(verify_url) }}" x="88" y="622" width="88" height="88"/> <text x="132" y="728" text-anchor="middle" font-size="8" letter-spacing="2" fill="#5B6773" font-family="Noto Sans, sans-serif">SCAN TO VERIFY</text> <path d="M272 700L256 752L273 742L282 756L297 712ZM323 700L339 752L322 742L313 756L298 712Z" fill="#1F3A5F"/> <circle cx="297.5" cy="670" r="46" fill="#B8944F"/> <circle cx="297.5" cy="670" r="40" fill="#1F3A5F"/> <circle cx="297.5" cy="670" r="35" fill="none" stroke="#D9BE82" stroke-width=".8"/> <text x="297.5" y="687" text-anchor="middle" font-size="46" fill="#D9BE82" font-family="Noto Serif Display, serif">N</text> <image href="data:image/png;base64,iVBORw0KGgo…" x="376" y="640" width="150" height="56" preserveAspectRatio="xMidYMax meet"/> <path d="M368 700H534" stroke="#B8944F" stroke-width=".8"/> <g text-anchor="middle" fill="#3F4A56"> <text x="451" y="718" font-size="13" fill="#1F3A5F" font-family="Noto Serif Display, serif">Zofia Lewandowska</text> <text x="451" y="732" font-size="8.5" font-family="Noto Serif, serif">Head of Training, Northbridge Advisory</text> </g> <text x="297.5" y="788" text-anchor="middle" font-size="8" fill="#5B6773" font-family="Noto Sans, sans-serif">Northbridge Advisory sp. z o.o., Marszałkowska 84/12, 00-514 Warszawa</text></svg>The logo, the frame and the seal are ordinary shapes. The signature is a PNG kept inside the file as a data URI, shortened here, so every certificate carries it with no variable at all.
And the data it is generated with:
{ "participant": { "name": "Maya Lindqvist" }, "course": { "title": "Data Protection for Managers", "date": "2026-03-15" }, "score": 94, "verify_url": "https://northbridge.example/verify/8841"}
-
Draw the page in your design tool and type the Twig tags into the text layers. The Figma section below shows how.
-
Export it as SVG, with text kept as text.
-
Open the file in a text editor and add any loops or conditions. Design tools have no place for them.
-
In Doxtly, click New template, choose the type SVG, and upload the file. See Creating a template.

-
Open the Variables tab and check the list is what you expect.

-
Generate a test document with a workflow or the API.
The file
Section titled “The file”- One file, one page. A template is one SVG in UTF-8, up to 10 MB, and it makes a one-page PDF. A multi-page document is not possible from one SVG.
- Read by its content. The file has to really be an SVG. Anything else is refused, whatever its name says. Its Twig is not tested at this point: a syntax error comes up when a document is generated.
- It fills the page. Whatever size the file gives, the drawing is scaled up or down to fill the page, right to its edges, keeping its proportions. A file exported at 595 by 842 pixels and one at 210 by 297 millimetres print the same on A4. A drawing with other proportions is centred, with white space on the two sides it doesn’t reach, so a landscape drawing on a portrait page ends up as a band across the middle. A file with neither a
viewBoxnor a size in numbers keeps its own size. - Text stays text. It is drawn with fonts available where the PDF is made. A font that is missing there is replaced, so the text may look slightly different. Use a common font, or turn purely decorative text into outlines.
- Text does not wrap. SVG has no paragraphs. Leave room for the longest value, or shorten it:
{{ notes|slice(0, 80) }}. - Quotes are repaired. Design tools write quotes inside text as entities (
"), or turn them into typographic ones as you type (“dd.MM.yyyy”). Inside{{ … }}and{% … %}tags, Doxtly turns both back into plain quotes when the file arrives. Everywhere else, your design stays as drawn, including any typographic quotes in a heading.
Page size
Section titled “Page size”Documents are A4 portrait by default. A workflow’s Generate document step always uses this, so a template used in a workflow is best drawn as A4 portrait. A call to the API can ask for another page under options.pdf, which is how you get a landscape certificate:
| Option | Values |
|---|---|
paper_size |
A4, A3, A5, Letter, Legal |
landscape |
true or false |
margin_top, margin_bottom, margin_left, margin_right |
Inches. Give all four, or they are ignored. With none, the drawing reaches the edges of the page. |
scale |
A number, such as 0.9 |
print_background |
true by default; false leaves backgrounds out |
Designing in Figma
Section titled “Designing in Figma”-
Replace sample text with tags, in the text of the layer itself:
{{ recipient }},{{ formatdate(issue_date, 'dd.MM.yyyy') }}. Keep these layers editable, never outlined or flattened. -
Export the frame as SVG, with Outline text off.
-
Check the file in a text editor: every
{{ … }}tag has to sit inside a<text>element.
<!-- Right: the tag is text --><text x="100" y="200">{{ recipient }}</text>
<!-- Wrong: the tag became a shape and cannot be filled in --><path d="M100 200 L120 220..."/>Illustrator and Inkscape work the same way: keep text as text when you export. A decorative layer that must look exactly as designed can be flattened into shapes, as long as it holds no tag.
Repeating rows
Section titled “Repeating rows”On a drawn page, every line has a position, so a loop has to count positions itself. Set a position before the loop and move it each round. What comes after the loop goes under the last line.
{% set y = 260 %}{% for item in items %} {% set y = y + 20 %} <text x="48" y="{{ y }}">{{ loop.index }}</text> <text x="72" y="{{ y }}">{{ item.name }}</text> <text x="547" y="{{ y }}" text-anchor="end">{{ item.price|formatnumber(2, '.', ',') }}</text>{% endfor %}<text x="547" y="{{ y + 30 }}" text-anchor="end">Total: {{ total|formatnumber(2, '.', ',') }}</text>Without a counter, y="{{ 260 + loop.index0 * 20 }}" places a row too. Remember that the page does not grow: a list longer than the space you left runs off it. Plan for your longest invoice, or use Word.
A section left out by a condition takes no room if the lines after it use the same counter. The rest of the language, including conditions, macros and automatic numbering, is on the Twig page.
Images
Section titled “Images”A picture from the data is drawn by an <image> element, with image() giving its address:
{% if company.logo is defined and company.logo %} <image href="{{ image(company.logo) }}" x="40" y="34" width="120" height="40" preserveAspectRatio="xMinYMid meet"/>{% endif %}The data holds the picture as a data URI, data:image/png;base64,iVBORw0KGgo…, of a PNG, JPEG, GIF, BMP, SVG or WebP, up to 10 MB. In a workflow, a file uploaded in a form arrives in this form by itself.
The picture is embedded in the document, because nothing beside the template file exists when the page is printed. You cannot link to a file by name. image() checks the value and stops the document with a clear error if it is not a usable picture. Printing the value straight into href shows a valid picture too, but a bad value then leaves an empty frame with no error, so prefer image().
QR codes and barcodes
Section titled “QR codes and barcodes”qrcode() and barcode() give a code as a picture for an <image> element, which places and sizes it:
<image href="{{ qrcode(invoice.payment_url) }}" x="40" y="698" width="96" height="96"/><image href="{{ barcode(invoice.number) }}" x="375" y="698" width="180" height="50" preserveAspectRatio="none"/><text x="465" y="762" text-anchor="middle">{{ invoice.number }}</text>| Function | Arguments |
|---|---|
qrcode(data, size = 200, format = 'png') |
size: pixels a side, at most 2000 for a PNG. format: png, or svg for a code that stays sharp at any size. |
barcode(data, type = 'code128', widthFactor = 2, height = 60) |
widthFactor: pixels of the narrowest bar. height: pixels. At most 4,000,000 pixels in all. Always a PNG. |
Empty data draws no code. So does data the barcode type cannot hold, such as letters in an EAN-13, or a code too large for the limits above: the document is still made, with no code in it. A type name Doxtly does not know gives a Code 128. Check a test document before going live.
A QR code holds any text: a link, a vCard, payment details.
| Barcode type | Data |
|---|---|
code128 (default), code128a, code128b, code128c |
Any text. Subsets: A (capitals and control characters), B (full ASCII), C (pairs of digits). |
code39, code39+, code39e, code39e+, code93 |
Letters and digits. |
ean13, ean8, upca, upce |
12, 7, 11 or 6 digits, with or without the check digit. |
ean5, ean2 |
EAN add-ons. |
itf14, interleaved25 or i25, standard25 or s25 |
Digits, as on shipping cartons. |
code11, codabar, msi, msi+ |
Digits. Codabar also takes -$:/.+. |
pharmacode, pharma2t |
Pharmaceutical packaging. |
postnet, planet, imb, rms4cc, kix |
Postal codes of the US, UK and Dutch posts. |
Signatures
Section titled “Signatures”When a document goes out for signing, the text [SIGNATURE:SELLER] marks where the party SELLER signs. The party’s name is capital letters, digits and _, beginning with a letter. Every party found this way appears on the Parties tab. See Signing.
[IN:CLIENT] marks where the party puts its initials, and is read the same way. When you upload a template, the form warns if a marker has too little room around it.
<text x="60" y="760">[SIGNATURE:CLIENT]</text><text x="340" y="760">[SIGNATURE:CONSULTANT]</text>Only the template’s own text names a signer. A value from the data that happens to read like a marker is printed with a look-alike character in it, so a client who types [SIGNATURE:CLIENT] into a form cannot create a signing place. Your template’s logic still sees the data as it was sent.
Markers are read the way they will be printed, one <text> element at a time. To be safe:
- Write a marker in one
<text>element, on one line. A break right after the colon is the one exception. - Splitting it into
<tspan>parts on the same line is fine, which is what editors do with a kerned pair or a bold word. - Avoid
dx, adyon its own, and letter spacing of a tenth of the font size or more inside a marker. - Two separate text elements placed side by side name nobody.
- Nothing that is not printed counts: comments, attributes,
<title>,<desc>, text hidden withdisplayorvisibility, and text in<defs>or an unused<symbol>.
Fonts print brackets and colons in their ordinary form, so that the signing page can read the marker. With the Inter font, Figma’s default, those signs may look very slightly different from the design.
Values from a spreadsheet
Section titled “Values from a spreadsheet”A workflow that looks up a row in a spreadsheet offers it to a document generated later in the run, twice, under the step’s output key:
<outputKey>.row.<column>holds typed values: numbers, dates as2026-06-15, booleans. Calculate and compare with these.<outputKey>.display.<column>holds the same cells formatted for your organization’s language. Print these.
<outputKey>.found says whether a row was found. The Load rows step offers rows and displayRows, in the same order, plus count and truncated.
<text x="40" y="120">Exam date: {{ trainee.display.exam_date }}</text>{% if trainee.row.score >= 50 %} <text x="40" y="140">Passed with {{ trainee.display.score }}%</text>{% endif %}Using a file from the cloud
Section titled “Using a file from the cloud”An SVG can follow a file in Google Drive, OneDrive, SharePoint, Dropbox or Box. Your designer saves a new version in the drive, and Doxtly takes it automatically as long as it is an SVG of up to 10 MB. Its Twig is not tested on the way in, so a typo in a tag fails the next documents. If a change adds a required variable, documents fail until the data supplies it, so tell whoever owns the workflow.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause |
|---|---|
{{ recipient }} is printed as it is. |
The text was outlined, or the tag is split across <tspan> elements. Retype it in one go in an editable layer and export again. |
| The Variables tab is empty although the file has tags. | Twig cannot read the file, usually because of an unclosed tag. Generate a test document: the error names the line. |
| The request is refused for missing variables. | The error names them. Add them to the data, or make them optional with is defined or default. |
| An error names a line. | See When something goes wrong. |
| Text overflows its place. | SVG text does not wrap. Leave room, or use slice. |
| Rows run off the page. | The list is longer than the page allows. |
| The design sits in a band across the page. | It is drawn landscape on a portrait page. See Page size. |
| A code is missing. | Its data was empty, or not something that barcode type can hold. |
| Characters are wrong. | Save the SVG in UTF-8. |
| A signature place is not found. | Check the marker rules, and the Parties tab. |