Dokmatiq DocGen

v0.1.3
io.github.dokmatiq/docgen Checked 1 day ago Published 2 months ago

Generate PDF, DOCX and Excel documents, e-invoices and signed PDFs, and recognize receipts.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

generate_pdf_from_html

Generate a PDF from HTML content. Args: html: HTML content to convert to PDF. Returns: Base64-encoded PDF bytes.

ParameterTypeDescription
html *string

generate_pdf_from_markdown

Generate a PDF from Markdown content. Args: markdown: Markdown content to convert to PDF. Returns: Base64-encoded PDF bytes.

ParameterTypeDescription
markdown *string

generate_document

Generate a document with optional template, fields, and watermark. Args: html_content: HTML content for the document body. markdown_content: Markdown content (alternative to HTML). template_name: Name of a pre-uploaded template (ODT/DOCX). fields: Template field replacements (key-value pairs). watermark: Diagonal watermark text overlay. output_format: Output format – PDF, DOCX, or ODT (default: PDF). Returns: Base64-encoded document bytes.

ParameterTypeDescription
fields
html_content
markdown_content
output_formatstring
template_name
watermark

compose_document

Compose a multi-part document from several sections. Each part is a dict with: htmlContent, markdownContent, templateName, fields. Args: parts: List of document parts. Each part can have htmlContent, markdownContent, templateName, fields. watermark: Optional diagonal watermark text overlay. output_format: Output format – PDF, DOCX, or ODT (default: PDF). Returns: Base64-encoded document bytes.

ParameterTypeDescription
parts *array
output_formatstring
watermark

create_invoice

Create a ZUGFeRD-compliant invoice PDF with structured e-invoicing data. Each item in the items list should have: description, unitPrice, and optionally quantity, unit (C62=piece, HUR=hour, DAY=day, KGM=kg), vatRate. Args: invoice_number: Unique invoice number (e.g. "RE-2026-001"). invoice_date: Invoice date in ISO format (e.g. "2026-04-12"). seller_name: Seller company name. seller_street: Seller street address. seller_zip: Seller postal code. seller_city: Seller city. buyer_name: Buyer company name. buyer_street: B…

ParameterTypeDescription
buyer_city *string
buyer_name *string
buyer_street *string
buyer_zip *string
invoice_date *string
invoice_number *string
items *array
seller_city *string
seller_name *string
seller_street *string
seller_zip *string
bic
buyer_countrystring
buyer_vat_id
currencystring
due_date
html_content
iban
payment_terms
seller_countrystring
seller_vat_id
template_name

merge_pdfs

Merge multiple PDFs into a single PDF. Args: pdfs_base64: List of base64-encoded PDF files to merge. Returns: Base64-encoded merged PDF.

ParameterTypeDescription
pdfs_base64 *array

extract_text_from_pdf

Extract all text content from a PDF. Args: pdf_base64: Base64-encoded PDF file. Returns: Extracted text content.

ParameterTypeDescription
pdf_base64 *string

get_pdf_metadata

Get metadata (title, author, page count, etc.) from a PDF. Args: pdf_base64: Base64-encoded PDF file. Returns: JSON string with metadata fields.

ParameterTypeDescription
pdf_base64 *string

convert_to_pdfa

Convert a PDF to PDF/A archival format. Args: pdf_base64: Base64-encoded PDF file. Returns: Base64-encoded PDF/A file.

ParameterTypeDescription
pdf_base64 *string

rotate_pdf

Rotate pages in a PDF. Args: pdf_base64: Base64-encoded PDF file. angle: Rotation angle in degrees (90, 180, 270). pages: Page range to rotate (e.g. "1-3", "all"). Default: all pages. Returns: Base64-encoded rotated PDF.

ParameterTypeDescription
angle *integer
pdf_base64 *string
pages

inspect_pdf_form

Inspect form fields in a PDF and return their names, types, and current values. Args: pdf_base64: Base64-encoded PDF file with form fields. Returns: JSON array of form field definitions.

ParameterTypeDescription
pdf_base64 *string

fill_pdf_form

Fill form fields in a PDF. Args: pdf_base64: Base64-encoded PDF file with form fields. fields: Field name-value pairs to fill. flatten: Whether to flatten the form (make fields non-editable). Returns: Base64-encoded filled PDF.

ParameterTypeDescription
fields *object
pdf_base64 *string
flattenboolean

sign_pdf

Digitally sign a PDF with a PKCS#12 certificate. Args: pdf_base64: Base64-encoded PDF to sign. certificate_name: Name of a pre-uploaded certificate. certificate_password: Password for the certificate. reason: Reason for signing. location: Location of signing. Returns: Base64-encoded signed PDF.

ParameterTypeDescription
certificate_name *string
certificate_password *string
pdf_base64 *string
location
reason

verify_pdf_signatures

Verify digital signatures in a PDF. Args: pdf_base64: Base64-encoded signed PDF. Returns: JSON with verification results (signed, signatureCount, allValid, signatures).

ParameterTypeDescription
pdf_base64 *string

list_certificates

List all uploaded signing certificates. Returns: JSON array of certificate info objects.

list_templates

List all uploaded document templates. Returns: JSON array of template info objects.

upload_template

Upload a document template (ODT or DOCX). Args: template_base64: Base64-encoded template file. filename: Filename for the template (e.g. "invoice.odt"). Returns: JSON with upload result.

ParameterTypeDescription
filename *string
template_base64 *string

delete_template

Delete a template by name. Args: name: Name of the template to delete. Returns: Confirmation message.

ParameterTypeDescription
name *string

list_fonts

List all uploaded custom fonts. Returns: JSON array of font info objects.

preview_pdf_page

Render a PDF page as a PNG image preview. Args: pdf_base64: Base64-encoded PDF file. page: Page number (1-based, default: 1). dpi: Resolution in DPI (default: 150). Returns: Base64-encoded PNG image.

ParameterTypeDescription
pdf_base64 *string
dpiinteger
pageinteger

get_pdf_page_count

Get the total number of pages in a PDF. Args: pdf_base64: Base64-encoded PDF file. Returns: Page count.

ParameterTypeDescription
pdf_base64 *string

validate_zugferd

Validate a ZUGFeRD/Factur-X PDF for compliance. Args: pdf_base64: Base64-encoded PDF with embedded ZUGFeRD data. Returns: JSON validation result (valid, profile, errors, warnings).

ParameterTypeDescription
pdf_base64 *string

extract_zugferd

Extract structured invoice data from a ZUGFeRD/Factur-X PDF. Args: pdf_base64: Base64-encoded ZUGFeRD PDF. Returns: JSON with extracted invoice data.

ParameterTypeDescription
pdf_base64 *string

validate_xrechnung

Validate XRechnung XML for compliance. Args: xml: XRechnung XML content. Returns: JSON validation result (valid, format, errors, warnings).

ParameterTypeDescription
xml *string

parse_xrechnung

Parse XRechnung XML into structured invoice data. Args: xml: XRechnung XML content. Returns: JSON with parsed invoice data.

ParameterTypeDescription
xml *string

detect_xrechnung

Detect if an XML document is an XRechnung and identify its format. Args: xml: XML content to analyze. Returns: JSON with detection result (detected, format, version).

ParameterTypeDescription
xml *string

generate_excel

Generate an Excel workbook (.xlsx) from a structured JSON definition. The request dict should contain: sheets: List of sheet definitions, each with: name: Sheet tab name columns: Column definitions (header, width, format, align) rows: Data rows (list of dicts with 'values' or 'cells') formulas: List of formula definitions (cell, formula, label) headerFooter: Print header/footer configuration printArea: Print area in A1 notation freezePane: {row, col} for frozen panes headerStyle/dataSty…

ParameterTypeDescription
request *object

csv_to_excel

Convert CSV content into a styled Excel workbook. Auto-formats with header styling, auto-filter, frozen header row, and auto-sized columns. Args: csv_content: Raw CSV text content. delimiter: CSV delimiter (default: comma). has_header: Whether the first row is a header (default: true). sheet_name: Name for the sheet tab (default: "Data"). Returns: Base64-encoded XLSX file.

ParameterTypeDescription
csv_content *string
delimiterstring
has_headerboolean
sheet_name

excel_to_csv

Extract data from an Excel sheet and return it as CSV text. Args: excel_base64: Base64-encoded Excel file. sheet_index: Sheet index to extract (0-based, default: 0). delimiter: CSV delimiter (default: comma). Returns: CSV text content.

ParameterTypeDescription
excel_base64 *string
delimiterstring
sheet_indexinteger

excel_to_json

Extract data from an Excel sheet and return structured JSON. Returns headers (if present) and typed data rows. Args: excel_base64: Base64-encoded Excel file. sheet_index: Sheet index to extract (0-based, default: 0). has_header: Whether the first row is a header (default: true). Returns: JSON with sheetName, totalRows, headers, and data array.

ParameterTypeDescription
excel_base64 *string
has_headerboolean
sheet_indexinteger

fill_excel_template

Fill an Excel template with data at named cells and ranges. Args: template_base64: Base64-encoded Excel template file. values: Cell values to set (key = cell ref like 'Sheet1!A1' or named range, value = content). tables: Table data to insert at named ranges (key = range name, value = row arrays). recalculate: Recalculate formulas after filling (default: true). Returns: Base64-encoded filled XLSX file.

ParameterTypeDescription
template_base64 *string
recalculateboolean
tables
values

inspect_excel

Inspect an Excel workbook and return metadata. Returns sheet names, row/column counts, and named ranges. Args: excel_base64: Base64-encoded Excel file. Returns: JSON with sheetCount, sheets array, and namedRanges.

ParameterTypeDescription
excel_base64 *string

extract_receipt

Extract structured data from a receipt or invoice image using AI. Returns vendor, date, totals (gross/net/VAT per rate), line items, currency, payment method, SKR03/04 account, category, and confidence score. Args: image_base64: Base64-encoded receipt image (JPEG, PNG) or PDF. filename: Original filename (helps with format detection). content_type: MIME type (default: image/jpeg). Use application/pdf for PDF receipts. Returns: JSON with extracted receipt data.

ParameterTypeDescription
image_base64 *string
content_typestring
filenamestring

extract_receipt_async

Submit a receipt for async AI extraction. Returns a job ID for polling. Use get_receipt_job to check status and get_receipt_job_result for the result. Args: image_base64: Base64-encoded receipt image or PDF. filename: Original filename. content_type: MIME type (default: image/jpeg). callback_url: Optional webhook URL to receive the result. Returns: JSON with jobId and status.

ParameterTypeDescription
image_base64 *string
callback_url
content_typestring
filenamestring

get_receipt_job

Check the status of an async receipt extraction job. Args: job_id: The job ID returned by extract_receipt_async. Returns: JSON with job status (PENDING, PROCESSING, COMPLETED, FAILED).

ParameterTypeDescription
job_id *string

get_receipt_job_result

Get the extraction result of a completed async receipt job. Args: job_id: The job ID returned by extract_receipt_async. Returns: JSON with extracted receipt data.

ParameterTypeDescription
job_id *string

list_receipt_jobs

List all async receipt extraction jobs. Returns: JSON array of job info objects.

receipt_to_document

Extract receipt data and generate an expense report document. Combines AI extraction with document generation in a single step. Args: image_base64: Base64-encoded receipt image or PDF. filename: Original filename. content_type: MIME type (default: image/jpeg). output_format: Output format – PDF, DOCX, or ODT (default: PDF). title: Document title (default: "Spesenbeleg"). template_name: Optional template for the expense report layout. Returns: JSON with extracted data and base64-encoded document.

ParameterTypeDescription
image_base64 *string
content_typestring
filenamestring
output_formatstring
template_name
titlestring

export_receipts_csv

Export extracted receipt data as DATEV-compatible CSV. Args: receipts: List of receipt extraction results (from extract_receipt). Returns: Base64-encoded CSV file.

ParameterTypeDescription
receipts *array

export_receipts_xlsx

Export extracted receipt data as Excel workbook (XLSX). Args: receipts: List of receipt extraction results (from extract_receipt). Returns: Base64-encoded XLSX file.

ParameterTypeDescription
receipts *array