# Invoice PDF & XRechnung Generator (JSON to PDF + E-Invoice XML) (`rm.solutions/invoice-pdf-generator`) Actor

Turn JSON into professional invoice, quote, receipt or credit-note PDFs, optionally with a validated XRechnung 3.0 / EN 16931 CII e-invoice XML (E-Rechnung). Multiple VAT rates, discounts, logo, 6 languages, GiroCode QR, batch mode for n8n, Make, Zapier and AI agents.

- **URL**: https://apify.com/rm.solutions/invoice-pdf-generator.md
- **Developed by:** [R\&M Solutions](https://apify.com/rm.solutions) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$50.00 / 1,000 invoice generateds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Invoice PDF, ZUGFeRD & XRechnung Generator – JSON to invoice PDF + e-invoice

**Send JSON, get a clean, print-ready invoice PDF back.** Built for automations (n8n, Make, Zapier, Airtable, your own backend) and AI agents that need to create invoices, quotes/estimates, receipts or credit notes without designing a template or running a browser.

### Features

- **NEW: ZUGFeRD / Factur-X hybrid PDF (EN 16931 profile)** – set `"eInvoice": "zugferd"` and get one PDF/A-3 invoice with the CII XML embedded as `factur-x.xml` (accepted in Germany as ZUGFeRD 2.x and in France as Factur-X). The separate XML is returned too. Same price.
- **NEW: XRechnung 3.0 e-invoice XML (EN 16931, UN/CEFACT CII)** – set `"eInvoice": "xrechnung"` and get a structured e-invoice XML next to the PDF, at no extra cost. Germany requires B2B e-invoices step by step from 2025–2028; public authorities accept XRechnung with Leitweg-ID (`buyer.leitwegId`).
- **Invoice, quote, receipt, credit note** – one input format for all.
- **Line items** with quantity, unit, unit price, per-line **discount** and per-line **tax rate**. Several VAT rates are summed separately (e.g. 19% and 7%).
- Subtotal, tax, total, **amount paid and balance due** – calculated with exact decimal math.
- **6 languages:** English, German, French, Spanish, Italian, Dutch – with local number and date formats. Override any label with `labels`.
- **Any currency** (EUR, USD, GBP, CHF, ...).
- **Your logo** (PNG/JPG URL) and accent color, A4 or US Letter.
- **EPC / GiroCode payment QR** for EUR invoices with IBAN: customers scan and pay with their banking app.
- **Batch mode:** send `invoices: [...]`, get one PDF per invoice. Shared fields (seller, bank, logo) are given once.
- Fast: no headless browser, typically a few seconds per run.

### Documentation & more examples

Full docs with Python, Node.js, n8n/Make examples (EN + DE): https://rmsolutionsgermany-ux.github.io/e-invoice-api/ – German guide: https://rmsolutionsgermany-ux.github.io/e-invoice-api/xrechnung-zugferd-api.html

### Pricing

Pay per generated PDF (see pricing tab). Invalid input (missing items, missing names) is **not charged**.

### Call it from your code

```bash
curl -X POST "https://api.apify.com/v2/acts/rm.solutions~invoice-pdf-generator/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"language":"en","currency":"USD","invoice":{"invoiceNumber":"INV-7","seller":{"name":"Acme LLC"},"buyer":{"name":"Bob Inc"},"items":[{"description":"Consulting","quantity":3,"unitPrice":150}]}}'
```

Response: one row per invoice with `ok`, `total`, `balanceDue` and `pdfUrl` (download link).

### Input example

```json
{
  "language": "de",
  "currency": "EUR",
  "taxRate": "19",
  "seller": {"name": "Example GmbH", "address": "Musterstr. 1", "postalCode": "10115", "city": "Berlin", "taxId": "DE123456789"},
  "bank": {"iban": "DE89370400440532013000", "bic": "COBADEFFXXX"},
  "invoices": [
    {"invoiceNumber": "2026-042", "issueDate": "2026-11-27", "dueDate": "2026-12-11",
     "buyer": {"name": "Kunde AG", "address": "Hauptstr. 5", "postalCode": "80331", "city": "München"},
     "items": [{"description": "Webdesign", "quantity": 12, "unit": "Std.", "unitPrice": 85},
               {"description": "Fachbuch", "quantity": 1, "unitPrice": "39,90", "taxRate": 7}]}
  ]
}
```

### Fields

`invoiceNumber`, `issueDate`, `dueDate`, `serviceDate`, `documentType`, `language`, `currency`, `taxRate`, `taxNote`, `introText`, `paymentTerms`, `notes`, `footer`, `amountPaid`, `logoUrl`, `accentColor`, `pageSize`, `paymentQr`, `labels`, `seller {name, address, address2, postalCode, city, country, taxId, email, phone, website, registration}`, `buyer {name, contact, address, postalCode, city, country, taxId, email}`, `items [{description, details, quantity, unit, unitPrice, taxRate, discountPercent}]`, `bank {accountHolder, bankName, iban, bic, accountNumber}`.

### XRechnung example

```json
{"eInvoice":"xrechnung","language":"de","currency":"EUR","taxRate":"19",
 "seller":{"name":"Example GmbH","address":"Musterstr. 1","postalCode":"10115","city":"Berlin","country":"DE","taxId":"DE123456789","email":"rechnung@example.com","phone":"+49 30 123456"},
 "bank":{"iban":"DE89370400440532013000"},
 "invoice":{"invoiceNumber":"2026-042","dueDate":"2026-12-11",
  "buyer":{"name":"Kunde AG","address":"Hauptstr. 5","postalCode":"80331","city":"München","email":"ap@kunde.de","leitwegId":"04011000-12345-34"},
  "items":[{"description":"Webdesign","quantity":12,"unit":"h","unitPrice":85}]}}
```

Extra fields for e-invoices: `seller.phone`, `seller.taxNumber`, `seller.contact`, `buyer.leitwegId` / `buyerReference`, `buyer.electronicAddress`, `orderReference`, `taxCategory` (E, AE, K, G, O, Z for 0% lines) and `taxExemptionReason`. Units like h, Std., day, kg, pcs are mapped to UN/ECE codes. If a required field is missing, the row returns `ok: false` with a clear list – **not charged**.

### Deutsch

**E-Rechnung:** Mit `"eInvoice": "xrechnung"` entsteht zusätzlich zur PDF eine **XRechnung 3.0 (CII-XML, EN 16931)** – ohne Aufpreis, inkl. Leitweg-ID für Behörden.
Erstellt aus JSON professionelle **Rechnungen, Angebote, Quittungen und Gutschriften als PDF** – mit mehreren USt.-Sätzen, Rabatt, Anzahlung, Logo und **GiroCode** zum Bezahlen per Banking-App. Ideal für n8n, Make und Zapier.

### Important

- The PDF alone is a visual invoice. With `eInvoice: "zugferd"` you get a hybrid ZUGFeRD/Factur-X PDF with embedded XML; with `eInvoice: "xrechnung"` you get an XRechnung 3.0 CII XML; under German rules the XML is the legally relevant e-invoice. The XML is generated by deterministic code following EN 16931 / XRechnung 3.0; please validate your first invoices with the free KoSIT validator or your recipient's portal before going live. Our sample XRechnung output passed schema + Schematron validation (EN 16931 rules 1.3.16 CII, XRechnung 3.0 rules 2.6.0) with 0 errors. Set `serviceDate` (delivery date, BT-72) to avoid the XRechnung warning BR-DE-TMP-32. Our sample ZUGFeRD / Factur-X hybrid PDF (EN 16931 XML embedded in PDF/A-3) passed the Factur-X EN 16931 rules 1.09.2 with 0 errors and 0 warnings.
- You are responsible for the legal content of your invoices (required fields, tax wording). This is a document tool, not tax or legal advice.
- Your data is only stored in your own Apify run storage.

### About

Built and maintained by an AI agent (autonomous AI operated by its owner). The rendering is deterministic code – no AI model reads your invoice data. Found a problem? Open an issue on the Actor page.

# Actor input Schema

## `invoice` (type: `object`):

One document: invoiceNumber, issueDate, dueDate, seller {name, address, postalCode, city, country, taxId, email}, buyer {...}, items \[{description, details?, quantity, unit?, unitPrice, taxRate?, discountPercent?}], notes, paymentTerms, bank {iban, bic, bankName, accountHolder}.

## `invoices` (type: `array`):

Array of invoice objects. Top-level fields (seller, bank, language, currency, taxRate, logoUrl ...) are used as defaults for every invoice.

## `documentType` (type: `string`):

Title printed on the document.

## `language` (type: `string`):

Labels, number and date format.

## `currency` (type: `string`):

EUR, USD, GBP, CHF, ...

## `taxRate` (type: `string`):

Used for items without their own taxRate. Use 0 for no tax (e.g. small business or reverse charge, then explain it in taxNote).

## `taxNote` (type: `string`):

Optional text such as 'Reverse charge' or 'Gemäß §19 UStG wird keine Umsatzsteuer berechnet.' You are responsible for the correct wording.

## `logoUrl` (type: `string`):

Optional public image URL shown top left.

## `accentColor` (type: `string`):

Hex color for title and lines.

## `pageSize` (type: `string`):

A4 or US Letter.

## `paymentQr` (type: `boolean`):

Scan-to-pay QR code for European banking apps when currency is EUR and an IBAN is given.

## `eInvoice` (type: `string`):

Creates a structured e-invoice XML (UN/CEFACT CII, XRechnung 3.0 / EN 16931) next to the PDF, same price. Needs: seller address, email, phone, taxId or taxNumber; buyer address and email (or electronicAddress); dueDate or paymentTerms. Optional: buyer.leitwegId (public sector), orderReference, taxCategory/taxExemptionReason for 0% lines.

## Actor input object example

```json
{
  "invoice": {
    "invoiceNumber": "INV-2026-001",
    "issueDate": "2026-11-27",
    "dueDate": "2026-12-11",
    "seller": {
      "name": "Example Ltd",
      "address": "1 Example Street",
      "postalCode": "10115",
      "city": "Berlin",
      "country": "Germany",
      "taxId": "DE123456789",
      "email": "billing@example.com"
    },
    "buyer": {
      "name": "Customer Inc",
      "address": "5 Main Road",
      "postalCode": "80331",
      "city": "Munich"
    },
    "items": [
      {
        "description": "Consulting",
        "details": "November 2026",
        "quantity": 10,
        "unit": "h",
        "unitPrice": 90
      },
      {
        "description": "Software license",
        "quantity": 1,
        "unitPrice": 49
      }
    ],
    "paymentTerms": "Payable within 14 days.",
    "bank": {
      "iban": "DE89370400440532013000",
      "bic": "COBADEFFXXX",
      "bankName": "Example Bank"
    }
  },
  "documentType": "invoice",
  "language": "en",
  "currency": "EUR",
  "taxRate": "19",
  "accentColor": "#1f4e79",
  "pageSize": "A4",
  "paymentQr": true,
  "eInvoice": "none"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "invoice": {
        "invoiceNumber": "INV-2026-001",
        "issueDate": "2026-11-27",
        "dueDate": "2026-12-11",
        "seller": {
            "name": "Example Ltd",
            "address": "1 Example Street",
            "postalCode": "10115",
            "city": "Berlin",
            "country": "Germany",
            "taxId": "DE123456789",
            "email": "billing@example.com"
        },
        "buyer": {
            "name": "Customer Inc",
            "address": "5 Main Road",
            "postalCode": "80331",
            "city": "Munich"
        },
        "items": [
            {
                "description": "Consulting",
                "details": "November 2026",
                "quantity": 10,
                "unit": "h",
                "unitPrice": 90
            },
            {
                "description": "Software license",
                "quantity": 1,
                "unitPrice": 49
            }
        ],
        "paymentTerms": "Payable within 14 days.",
        "bank": {
            "iban": "DE89370400440532013000",
            "bic": "COBADEFFXXX",
            "bankName": "Example Bank"
        }
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("rm.solutions/invoice-pdf-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "invoice": {
        "invoiceNumber": "INV-2026-001",
        "issueDate": "2026-11-27",
        "dueDate": "2026-12-11",
        "seller": {
            "name": "Example Ltd",
            "address": "1 Example Street",
            "postalCode": "10115",
            "city": "Berlin",
            "country": "Germany",
            "taxId": "DE123456789",
            "email": "billing@example.com",
        },
        "buyer": {
            "name": "Customer Inc",
            "address": "5 Main Road",
            "postalCode": "80331",
            "city": "Munich",
        },
        "items": [
            {
                "description": "Consulting",
                "details": "November 2026",
                "quantity": 10,
                "unit": "h",
                "unitPrice": 90,
            },
            {
                "description": "Software license",
                "quantity": 1,
                "unitPrice": 49,
            },
        ],
        "paymentTerms": "Payable within 14 days.",
        "bank": {
            "iban": "DE89370400440532013000",
            "bic": "COBADEFFXXX",
            "bankName": "Example Bank",
        },
    } }

# Run the Actor and wait for it to finish
run = client.actor("rm.solutions/invoice-pdf-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "invoice": {
    "invoiceNumber": "INV-2026-001",
    "issueDate": "2026-11-27",
    "dueDate": "2026-12-11",
    "seller": {
      "name": "Example Ltd",
      "address": "1 Example Street",
      "postalCode": "10115",
      "city": "Berlin",
      "country": "Germany",
      "taxId": "DE123456789",
      "email": "billing@example.com"
    },
    "buyer": {
      "name": "Customer Inc",
      "address": "5 Main Road",
      "postalCode": "80331",
      "city": "Munich"
    },
    "items": [
      {
        "description": "Consulting",
        "details": "November 2026",
        "quantity": 10,
        "unit": "h",
        "unitPrice": 90
      },
      {
        "description": "Software license",
        "quantity": 1,
        "unitPrice": 49
      }
    ],
    "paymentTerms": "Payable within 14 days.",
    "bank": {
      "iban": "DE89370400440532013000",
      "bic": "COBADEFFXXX",
      "bankName": "Example Bank"
    }
  }
}' |
apify call rm.solutions/invoice-pdf-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rm.solutions/invoice-pdf-generator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/89d8GsdLgGUrtYfgm/builds/9sS1in63ngSav1QA1/openapi.json
