# HTML to PDF: invoices on Letter landscape (pdfkit alternative)

**Use case:** 

Send a list of HTML strings (invoices, reports) and get one PDF per item, rendered in headless Chromium: here US Letter landscape with 0.5in margins and backgrounds. The pdfkit.from_string job with --page-size Letter -O Landscape, without the wkhtmltopdf binary. Empty or invalid items are listed and not charged. $0.80 per 1,000 PDFs.

## Input

```json
{
  "urls": [
    "https://example.com"
  ],
  "html": [
    {
      "name": "invoice-1001",
      "html": "<html><body style=\"font-family:sans-serif\"><h1>Invoice 1001</h1><table border=\"1\" cellpadding=\"6\"><tr><th>Item</th><th>Qty</th><th>Price</th></tr><tr><td>Widget</td><td>2</td><td>$10.00</td></tr></table><p>Total: $20.00</p></body></html>"
    },
    {
      "name": "report-q3",
      "html": "<html><body style=\"font-family:sans-serif;background:#eef4ff\"><h1>Q3 report</h1><p>Example report page with a background colour.</p></body></html>"
    }
  ],
  "format": "pdf",
  "pageSize": "Letter",
  "landscape": true,
  "margin": "0.5in",
  "printBackground": true,
  "fullPage": false,
  "device": "desktop",
  "viewportWidth": 1280,
  "viewportHeight": 800,
  "deviceScaleFactor": 1,
  "jpegQuality": 80,
  "waitUntil": "load",
  "delayMs": 1000,
  "hideCookieBanners": true,
  "hideSelectors": [],
  "darkMode": false,
  "blockAds": true,
  "timeoutSecs": 30,
  "maxConcurrency": 4
}
```

## Output

```json
{
  "url": {
    "label": "URL",
    "format": "string"
  },
  "finalUrl": {
    "label": "Final URL",
    "format": "string"
  },
  "status": {
    "label": "Status",
    "format": "string"
  },
  "httpStatus": {
    "label": "HTTP",
    "format": "number"
  },
  "title": {
    "label": "Page title",
    "format": "string"
  },
  "imageUrl": {
    "label": "Image",
    "format": "string"
  },
  "format": {
    "label": "Format",
    "format": "string"
  },
  "bytes": {
    "label": "Bytes",
    "format": "number"
  },
  "error": {
    "label": "Error",
    "format": "string"
  },
  "width": {
    "label": "width",
    "format": "number"
  },
  "height": {
    "label": "height",
    "format": "number"
  },
  "pageHeight": {
    "label": "pageHeight",
    "format": "integer"
  },
  "imagesPending": {
    "label": "imagesPending",
    "format": "integer"
  },
  "truncatedAt": {
    "label": "truncatedAt",
    "format": "integer"
  },
  "captureTiles": {
    "label": "captureTiles",
    "format": "integer"
  },
  "captureSeconds": {
    "label": "captureSeconds",
    "format": "number"
  },
  "loadState": {
    "label": "Load state",
    "format": "string"
  },
  "navigationRetries": {
    "label": "Redirect retries",
    "format": "integer"
  },
  "source": {
    "label": "source",
    "format": "string"
  },
  "htmlIndex": {
    "label": "htmlIndex",
    "format": "integer"
  },
  "name": {
    "label": "name",
    "format": "string"
  },
  "pageSize": {
    "label": "pageSize",
    "format": "string"
  },
  "landscape": {
    "label": "landscape",
    "format": "boolean"
  },
  "pages": {
    "label": "pages",
    "format": "integer"
  }
}
```

## How it works

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

The Website Screenshot API: Screenshot URL to PNG, JPEG or PDF Actor is ready to run with the inputs already set for "HTML to PDF: invoices on Letter landscape (pdfkit alternative)". [Sign up or log in](https://console.apify.com/create-task-from-example/yJpMdhsAZsiTa7Jx7) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "HTML to PDF: invoices on Letter landscape (pdfkit alternative)" task

The Website Screenshot API: Screenshot URL to PNG, JPEG or PDF Actor will start running based on the input automatically. You can also change all the input fields, like URLs, HTML strings, and more, to match your specific use case.

### 3. Receive the "HTML to PDF: invoices on Letter landscape (pdfkit alternative)" 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 URL, final url, status, 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 "HTML to PDF: invoices on Letter landscape (pdfkit alternative)" task via API](https://apify.com/hiver/bulk-website-screenshots.md).

## About this Actor

This example demonstrates how to use [Website Screenshot API: Screenshot URL to PNG, JPEG or PDF](https://apify.com/hiver/bulk-website-screenshots.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/hiver/bulk-website-screenshots.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/hiver/bulk-website-screenshots.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`).
