
#let brand-color = rgb("#334155")
#set page(paper: "us-letter", margin: (top: 3cm, bottom: 3cm, left: 2.5cm, right: 2.5cm))
#set text(font: "Times", size: 11pt, fill: rgb("#111827"))
// Header
#grid(
columns: (1fr, 1fr),
align(left)[
#text(size: 20pt, weight: "bold", fill: brand-color)[#data.company.name] \
#text(size: 9pt, fill: luma(100))[
#data.company.address \
#data.company.phone | #data.company.email
]
],
align(right)[
#text(size: 10pt, fill: luma(100))[
*Date:* #data.date
]
]
)
#v(2cm)
// Recipient
#text(weight: "bold")[#data.recipient.name] \
#data.recipient.title \
#data.recipient.company \
#data.recipient.address
#v(1cm)
// Salutation
#data.salutation,
#v(0.5cm)
// Body
#set par(justify: true, leading: 0.7em)
#data.body
#v(1cm)
// Closing
#data.closing,
#v(2cm)
// Signature
#text(weight: "bold")[#data.sender.name] \
#data.sender.title \
#data.sender.company
{
"date": "August 6, 2026",
"company": {
"name": "PDFDyno Inc.",
"address": "123 API Way, Tech City, CA 94107",
"phone": "+1 (555) 123-4567",
"email": "hello@pdfdyno.com"
},
"recipient": {
"name": "Mr. John Smith",
"title": "Director of Operations",
"company": "Global Solutions LLC",
"address": "456 Enterprise Blvd, Suite 100\nNew York, NY 10001"
},
"salutation": "Dear Mr. Smith",
"body": "I am writing to formally propose our new document automation services for Global Solutions LLC. As we discussed last week, integrating PDFDyno into your existing workflow can reduce manual document generation time by up to 80%.\n\nOur platform leverages a highly optimized Typst rendering engine to generate pixel-perfect PDFs in milliseconds. We have enclosed a detailed breakdown of the proposed architecture and pricing for your review.\n\nPlease let me know if you would like to schedule a follow-up call next week to discuss this proposal in further detail. We look forward to the possibility of a fruitful partnership.",
"closing": "Sincerely",
"sender": {
"name": "Alice Johnson",
"title": "Account Executive",
"company": "PDFDyno Inc."
}
}
# 1. Save the Typst code from the tab above as 'template.typ'
# 2. Save the JSON data from the tab above as 'data.json'
# 3. Combine them and call the API (requires jq)
jq -n \
--arg t "$(cat template.typ)" \
--argjson d "$(<data.json)" \
'{ "data": $d, "template": $t }' > request.json
curl -X POST https://api.pdfdyno.com/v1/pdf/generate \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @request.json \
--output letter.pdf