Excel to PDF — print spreadsheets cleanly without an Office install
Convert .xlsx files to PDFs that match Excel's print preview. With print areas, repeating rows, page orientation and PDF/A output.
What it does
The API accepts a .xlsx file and renders it as a PDF — just like Excel’s print preview would show the worksheet. Formulas are evaluated, formatting is preserved, charts are embedded as vectors.
Minimal request
curl -X POST https://api.dokmatiq.com/v1/convert/excel-to-pdf \
-H "Authorization: Bearer $DOKMATIQ_KEY" \
-F "document=@revenue-q1.xlsx" \
-o revenue-q1.pdf
Response: Content-Type: application/pdf, status 200.
Print options
Most Excel print settings can be overridden:
{
"orientation": "landscape",
"fitToPage": true,
"scaling": 100,
"printArea": "A1:H50",
"repeatRows": "1:3",
"repeatColumns": "A:A",
"gridlines": false,
"blackAndWhite": false,
"margins": { "top": "15mm", "bottom": "15mm", "left": "15mm", "right": "15mm" },
"headerFooter": {
"header": "&L&B&D&R&P / &N",
"footer": "&CConfidential — do not distribute"
}
}
Print areas set inside the workbook are honoured if no explicit values are provided.
Selecting worksheets
By default all visible worksheets are converted, each starting on its own page range. For a targeted selection:
{
"sheets": ["Summary", "Details Q1", "Details Q2"],
"pageBetweenSheets": true
}
pageBetweenSheets: true guarantees each sheet starts on a new page — otherwise printing continues as soon as there’s room.
What converts cleanly
- Cell formats (numbers, dates, currency, custom)
- Conditional formatting (colour bars, data scales, icon sets)
- Cell merges, borders, shading
- Headers and footers using the usual Excel codes (
&P,&N,&D,&F,&A) - Charts (column, bar, line, pie, scatter) — as embedded SVGs
- Images anchored to cells
- Formulas (evaluated server-side, including INDIRECT/LOOKUP)
- Groupings and outlines (optionally expanded)
What needs extra attention
- VBA macros (
.xlsm): ignored; cell values remain as computed - External links: not re-fetched — the last values stored in Excel are used
- ActiveX controls: not supported
- Pivot tables with external data sources: rendered using cached data
- Conditional formatting using IF formulas: evaluated in full
What it’s used for
- Monthly closings, reporting exports from BI tools that emit Excel
- Delivery notes, order lists from inventory systems
- HR exports, payroll statements in printable form
- Price lists with thousands of rows for customer dispatch
- Inspection protocols from QA templates
Comparison with alternatives
| Dokmatiq Excel-to-PDF | Microsoft Excel (server) | LibreOffice Calc headless | xlsx-to-pdf (Node) | |
|---|---|---|---|---|
| Formula evaluation | yes | yes | yes | limited |
| Charts | vector | vector | vector | often as image |
| Conditional formatting | complete | complete | mostly | limited |
| Honour print areas | yes | yes | yes | often not |
| Scaling | API-side | problematic | daemon management | on you |
| Fidelity to Excel’s print preview | high | highest | good | medium |
For simple tables many open-source libraries suffice. As soon as formulas, charts and conditional formatting enter the picture, support cost quickly exceeds the cost of using an API.
Common pitfalls
- “The PDF has too many pages” — set
printAreaorfitToPage: true; otherwise every filled cell is printed - Columns cut off —
fitToPage: trueon width; otherwise Excel scales at “actual size” - Fonts differ — register corporate fonts via the font-upload endpoint
- Long texts in cells —
wrapTextmust be enabled in the source file; the API does not change cell layout
Try it now
100 conversions per month for free. No credit card. Stateless REST — you send, you receive.