# Generate PDF invoices from JSON rows

**Use case:** 

Builds a PDF invoice from the sample row, with two line items, 8.25% tax and the shared seller details and terms, and returns a download link for the file. Line totals, tax and balance due are computed for you. Pick a receipt, quote, packing slip or your own HTML template, and swap in your own rows.

## Input

```json
{
  "template": "invoice",
  "documents": [
    {
      "documentNumber": "INV-1001",
      "date": "2026-10-04",
      "dueDate": "2026-11-03",
      "buyer": {
        "name": "Northwind Studio",
        "address": "200 Market Street\nSpringfield, IL 62701"
      },
      "items": [
        {
          "description": "Website redesign",
          "quantity": 1,
          "unitPrice": 2400
        },
        {
          "description": "Hosting",
          "details": "12 months",
          "quantity": 12,
          "unit": "mo",
          "unitPrice": 15
        }
      ],
      "taxRate": 8.25
    }
  ],
  "defaults": {
    "currency": "USD",
    "seller": {
      "name": "Example Design Co.",
      "address": "1 Main Street\nAnytown, CA 94000",
      "email": "billing@example.com"
    },
    "paymentInstructions": "Bank transfer to account 000000, or pay online.",
    "terms": "Payment due within 30 days."
  },
  "pageSize": "Letter",
  "margin": "15mm",
  "pageNumbers": true,
  "fileNameField": "documentNumber",
  "saveHtml": false
}
```

## Output

```json
{
  "index": {
    "label": "Row",
    "format": "number"
  },
  "documentNumber": {
    "label": "Number",
    "format": "text"
  },
  "template": {
    "label": "Template",
    "format": "text"
  },
  "ok": {
    "label": "Generated",
    "format": "boolean"
  },
  "totals.total": {
    "label": "Total",
    "format": "number"
  },
  "totals.currency": {
    "label": "Currency",
    "format": "text"
  },
  "pages": {
    "label": "Pages",
    "format": "number"
  },
  "pdfUrl": {
    "label": "PDF",
    "format": "link"
  },
  "error": {
    "label": "Error",
    "format": "text"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Document Generator: invoices, receipts and quotes to PDF Actor is ready to run with the inputs already set for "Generate PDF invoices from JSON rows". [Sign up or log in](https://console.apify.com/create-task-from-example/3M12CahKu1YOUTCcR) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Generate PDF invoices from JSON rows" task

The Document Generator: invoices, receipts and quotes to PDF Actor will start running based on the input automatically. You can also change all the input fields, like template, documents, and more, to match your specific use case.

### 3. Receive the "Generate PDF invoices from JSON rows" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as row, number, template, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Generate PDF invoices from JSON rows" task via API](https://apify.com/examsens.ai/document-generator.md).

## About this Actor

This example demonstrates how to use [Document Generator: invoices, receipts and quotes to PDF](https://apify.com/examsens.ai/document-generator.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/examsens.ai/document-generator.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/examsens.ai/document-generator.md

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`).
