A Quarto extension for generating print-ready envelope PDFs programmatically using Typst. Supports common envelope sizes with configurable sender and recipient addresses.
quarto use template felixmil/quarto-envelopeThis will install the extension and create an example template.qmd file you can use as a starting point.
Set the format to envelope-typst in your document's YAML front matter and provide the sender and recipient addresses as arrays:
---
format:
envelope-typst:
size: C6
sender:
- "Jean Dupont"
- "12 rue de la Paix"
- "75001 Paris"
recipient:
- "Marie Martin"
- "45 avenue du Prado"
- "13008 Marseille"
---Then render with:
quarto render template.qmdHere's the output:
Here is another example with envelope_type: DL:
sender and recipient are top-level metadata keys (not under format:):
| Key | Description |
|---|---|
sender |
Sender address lines (array) |
recipient |
Recipient address lines (array) |
Format options go under format: envelope-typst::
| Option | Description | Default |
|---|---|---|
size |
Envelope size (see supported types below) | DL |
sender-fontsize |
Font size for the sender address | 11pt |
recipient-fontsize |
Font size for the recipient address | 14pt |
sender-width |
Width of the sender block | 30% |
recipient-width |
Width of the recipient block | 40% |
recipient-shift-x |
Horizontal offset for the recipient block | -10% |
recipient-shift-y |
Vertical offset for the recipient block | 10% |
You can specify size as a named size string or as a custom "HxW" string in millimeters.
| Type | Dimensions (H × W) |
|---|---|
C4 |
229 × 324 mm |
C5 |
162 × 229 mm |
C6 |
114 × 162 mm |
DL |
110 × 220 mm |
B4 |
250 × 353 mm |
B5 |
176 × 250 mm |
#10 |
105 × 241 mm |
#9 |
98 × 225 mm |
Monarch |
98 × 190 mm |
A2 |
111 × 146 mm |
Pass a "HxW" string in mm:
format:
envelope-typst:
size: 125x185To generate one envelope PDF per recipient from a CSV file, use the included render_envelopes.R script.
It renders template-batch.qmd — a minimal template with no hardcoded addresses — injecting sender and recipient data at render time via --metadata-file.
Create a CSV file with the following columns:
first_name,last_name,adresse,city,zip
Paul,Durant,12 rue de la Paix,Paris,75001
Jeanne,Durand,45 avenue des Fleurs,Lyon,69002A sample file is provided at data/recipients.csv.
Edit the sender variable at the top of render_envelopes.R, then run:
source("render_envelopes.R")Or from the terminal:
Rscript render_envelopes.ROne PDF per recipient will be written to output/, named envelope_<first>_<last>.pdf.
The script writes a temporary YAML file for each recipient containing the sender and recipient address arrays, then calls:
quarto render template-batch.qmd --output <name>.pdf --metadata-file <tmp>.yamlNote:
senderandrecipientmust not be defined in the front matter oftemplate-batch.qmd, as document front matter takes precedence over--metadata-file.

