Professional document and spreadsheet generation as a service. Convert HTML, Markdown, and templates into pixel-perfect PDFs, DOCX, e-invoices, and Excel workbooks -- with a single API call.
DocGen is a powerful document and spreadsheet generation API built for developers who need reliable, high-quality output at scale. Whether you're generating invoices, contracts, reports, data exports, or certificates -- DocGen handles the complexity so you can focus on your application.
| Feature | Description |
|---|---|
| Document Generation | HTML, Markdown, and ODT templates to PDF/DOCX with field substitution, images, QR codes, tables, and barcodes |
| Multi-Part Composition | Combine multiple document parts into a single output with shared watermarks and stationery |
| PDF Operations | Merge, split, rotate, extract text, read/write metadata, convert to PDF/A |
| Digital Signatures | Sign PDFs with PKCS#12 certificates, verify existing signatures |
| PDF Forms | Inspect and fill PDF form fields programmatically |
| ZUGFeRD / Factur-X | Embed and extract structured invoice data in PDF invoices (EN16931, XRechnung) |
| XRechnung | Generate, parse, validate, and transform e-invoices (CII and UBL formats) |
| Excel Generation | Create styled XLSX workbooks from JSON, CSV, or templates -- with formulas, freeze panes, print areas, and cell styling |
| Excel Conversion | Convert between XLSX, CSV, and JSON; fill Excel templates with data |
| Receipt Recognition | AI-powered extraction of receipts and invoices to structured JSON with SKR03/04 account mapping and DATEV export |
| Watermarks & Stationery | Add text watermarks and PDF letterhead backgrounds |
| Preview | Render PDF pages as PNG images for thumbnail generation |
| Async Processing | Long-running jobs with polling and webhook callbacks |
We provide official SDKs with fluent builder APIs, typed models, automatic retries, and comprehensive error handling:
|
from docgen import DocGen
dg = DocGen("your-api-key")
pdf = dg.html_to_pdf("<h1>Hello!</h1>") |
import { DocGen } from "@dokmatiq/docgen";
const dg = new DocGen({ apiKey: "your-api-key" });
const pdf = await dg.htmlToPdf("<h1>Hello!</h1>"); |
Maven: var dg = new DocGen("your-api-key");
byte[] pdf = dg.htmlToPdf("<h1>Hello!</h1>"); |
using Dokmatiq.DocGen;
using var dg = new DocGenClient("your-api-key");
byte[] pdf = dg.HtmlToPdf("<h1>Hello!</h1>"); |
use Dokmatiq\DocGen\DocGen;
$dg = new DocGen("your-api-key");
$pdf = $dg->htmlToPdf("<h1>Hello!</h1>"); |
All SDKs live in our docgen-sdks repository.
Every SDK provides an intuitive, chainable builder for complex documents:
pdf = (dg.document()
.html("<h1>Invoice {{nr}}</h1>")
.template("invoice.odt")
.field("nr", "RE-2026-001")
.field("date", "2026-04-12")
.image("logo", "logo.png")
.qr_code("payment", "BCD\n002\n1\nSCT\n...")
.table("items", TableData(
columns=[ColumnDef("Article", 80), ColumnDef("Price", 30)],
rows=[["Widget", "9.99"], ["Gadget", "24.99"]],
))
.watermark("DRAFT")
.as_pdf()
.generate())Built-in support for German and European e-invoicing standards:
invoice = (dg.invoice()
.number("RE-2026-001")
.date("2026-04-12")
.seller(Party("ACME GmbH", "Musterstr. 1", "10115", "Berlin"))
.buyer(Party("Kunde AG", "Kundenweg 5", "20095", "Hamburg"))
.item(InvoiceItem("Consulting", 120.0, quantity=8, unit=InvoiceUnit.HOUR))
.bank(BankAccount("DE89370400440532013000"))
.build())
# Embed ZUGFeRD XML in PDF
zugferd_pdf = dg.zugferd.embed("invoice.pdf", invoice)
# Generate XRechnung XML
xrechnung_xml = dg.xrechnung.generate(invoice)Create fully styled Excel workbooks programmatically -- or convert between CSV, JSON, and XLSX:
# Generate a styled workbook from structured data
xlsx = dg.excel.generate({
"sheets": [{
"name": "Sales Q1",
"columns": [
{"header": "Product", "width": 25},
{"header": "Revenue", "width": 15, "format": "#,##0.00 €"},
],
"rows": [
{"values": ["Widget", 12500.50]},
{"values": ["Gadget", 8300.00]},
],
"formulas": [
{"cell": "B4", "formula": "SUM(B2:B3)", "label": "Total"}
],
"freezePane": {"row": 1, "col": 0},
"autoFilter": True,
}]
})
# Quick CSV → Excel conversion
xlsx = dg.excel.from_csv(csv_data, has_header=True)
# Extract Excel data as JSON
data = dg.excel.to_json(excel_base64)
# Fill an existing Excel template
xlsx = dg.excel.fill_template(template_base64, values={"B2": "Q1 2026"})Extract structured data from receipt and invoice images -- with automatic SKR03/04 account mapping, multi-currency support, and DATEV-compatible export:
# Extract receipt data from an image
result = dg.receipts.extract("receipt.jpg")
print(result["vendor"]) # "REWE Markt GmbH"
print(result["total"]) # {"gross": 23.47, "net": 21.56, "vat": 1.91}
print(result["currency"]) # "EUR"
print(result["skr03Account"]) # "4650"
print(result["category"]) # "Bewirtung"
print(result["lineItems"]) # [{description, quantity, unitPrice, total}, ...]
print(result["confidence"]) # 0.95
# Async extraction for large batches
job = dg.receipts.extract_async("receipt.jpg")
result = dg.receipts.wait_for(job["jobId"])
# Export as DATEV-compatible CSV
csv = dg.receipts.export_datev([result])Extracted fields: vendor, date, total (gross/net/VAT per rate), currency, payment method, line items, SKR03/04 account, category, tax ID, and quality confidence score.
DocGen integrates seamlessly with AI workflows:
- MCP Server -- Use DocGen as a tool in Claude Desktop, Claude Code, or any MCP-compatible AI assistant
- Claude Code Skill -- Natural language document generation directly from your terminal
- Create an account at the Dokmatiq Developer Portal
- Generate an API key in your dashboard
- Install an SDK and start generating documents in minutes
# Python
pip install dokmatiq-docgen
# TypeScript / Node.js
npm install @dokmatiq/docgen
# Java (Maven)
# Add com.dokmatiq:docgen-sdk to your pom.xml
# C# / .NET
dotnet add package Dokmatiq.DocGen
# PHP
composer require dokmatiq/docgen-sdk- Developer Portal -- Sign up, manage API keys, view usage
- API Documentation -- Full REST API reference
- SDK Repository -- Source code for all SDKs
- Website -- Product information and pricing
Built in Germany. Made for developers.
Questions? Reach us at developer@dokmatiq.com