Word to PDF — faithful conversion without Microsoft Office on your server
Convert .docx files into PDFs that match the original visually. With embedded fonts, headers/footers, placeholder substitution and PDF/A archive output.
What it does
The API takes a .docx file and returns a PDF with layout-faithful conversion. No MS Word and no LibreOffice daemon of your own needed — the rendering engine runs server-side, deterministically and horizontally scalable.
Bonus: placeholders can be substituted before conversion — so a contract template gets filled automatically with customer data.
Minimal request
curl -X POST https://api.dokmatiq.com/v1/convert/word-to-pdf \
-H "Authorization: Bearer $DOKMATIQ_KEY" \
-F "document=@contract-template.docx" \
-o contract.pdf
Response: Content-Type: application/pdf, status 200.
With placeholder substitution
A .docx with placeholders like {{customerName}}, {{date}}, {{amount}}:
curl -X POST https://api.dokmatiq.com/v1/convert/word-to-pdf \
-H "Authorization: Bearer $DOKMATIQ_KEY" \
-F "document=@contract-template.docx" \
-F 'variables={"customerName":"Acme AG","date":"2026-04-18","amount":"€12,500.00"}' \
-F "outputProfile=PDF/A-3b" \
-o contract-acme.pdf
The placeholder syntax works with text, but also with images ({{logo}}), tables (row-wise with {#items}...{/items}) and simple conditions ({#isPremium}...{/isPremium}).
What converts cleanly
- Fonts (embedded or replaced with metric-compatible ones)
- Headers and footers, page numbers
- Tables of contents (with page references, clickable inside the PDF)
- Tables with cell merges, borders, shading
- Embedded images (PNG, JPEG, SVG)
- Hyperlinks
- Footnotes, endnotes
- Comments (optionally hidden)
- Tracked changes (optionally accepted or kept as annotations)
What needs extra attention
- Exotic OLE objects (embedded Excel charts): converted as static images
- Macros (
.docm): ignored (security), content is preserved - Password-protected sections: must be unlocked
- Non-standard fonts: only loaded server-side from a curated font pool; missing fonts fall back through a substitution table
What it’s used for
- Contracts from Word templates with CRM data
- Quotes, orders, invoices from SAP/DATEV exports
- Reports, appraisals with long prose and figures
- Government letters, legal notices built from legal text modules
- Mail merge — one template, hundreds of personalisations
Comparison with alternatives
| Dokmatiq Word-to-PDF | Microsoft Office (server) | LibreOffice headless | docx2pdf (Python) | |
|---|---|---|---|---|
| License | included | commercial, restrictive | LGPL | MIT, needs Office |
| Scaling | API-side | hard on Linux | daemon management | local, not parallel |
| Layout fidelity | high | highest | good, occasional quirks | only with Office |
| Placeholders | built-in | via OpenXML SDK | external | external |
| Deterministic | yes | no (auto-update risk) | mostly | mostly |
| PDF/A | flag-driven | limited | yes | no |
Running Microsoft Office server-side is legally murky and technically brittle. A LibreOffice daemon is a valid alternative but quickly turns into an operations concern (crashes, font management, zombie processes).
Common pitfalls
- TOC with wrong page numbers — run field updates in Word before upload; otherwise the PDF shows the old page numbers
- Missing corporate font — register corporate fonts via the font-upload endpoint; otherwise the fallback kicks in
- Track Changes accepted or rejected? — default is “accepted”; for review scenarios use
trackChanges: "visualize"to render as annotations - Encoding issues —
.docxis always UTF-8; hand-crafted OOXML files sometimes violate that and garble umlauts
Try it now
100 conversions per month for free. No credit card. Stateless REST — you send, you receive.