# Website to PDF API

> Website to PDF renders any public web page into a PDF document from a submitted URL. It returns a temporary signed download link, unique filename, and expiration timestamp, with paid plans adding the page count, paper size, custom margins, landscape layout and background printing control.

**Endpoint:** `POST https://api.apiverve.com/v1/websitetopdf`  
**Category:** Documents  
**Cost:** 40 credits per call  
**Canonical page:** https://apiverve.com/marketplace/websitetopdf

## Overview

A website to PDF API and webpage to PDF converter: pass a public URL and the page is rendered into a PDF file, in A4 or, on paid plans, Letter, Legal or another paper size. The page is loaded in headless Chrome and printed to PDF, so you get the same kind of document as saving a page from the browser, without running a browser yourself.

The response returns a temporary download link rather than the file itself, valid for two days, along with the generated file name, the URL that was converted and the margins and orientation used. It is a fit for archiving web pages, saving receipts and order confirmations, attaching a report page to an email, or keeping a dated copy of a page for records.

The Free plan prints in A4 portrait with 0.4-inch margins, with background colors and images included. Paid plans add control over the layout: custom margins on each side, landscape orientation, eight paper sizes from A6 up to Tabloid and Ledger, and an option to turn off background printing for an ink-saving document. Paid plans also receive the page count of the finished PDF.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/websitetopdf" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts","marginTop":0.4,"marginRight":0.4,"marginBottom":0.4,"marginLeft":0.4,"landscape":false,"format":"value","printBackground":true}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | Yes | The URL of the website to convert to PDF; without a scheme, https:// is assumed. url |
| `marginTop` | number | No | The top margin of the PDF in inches from 0 to 4 (e.g., 0.4). default 0.4. range 0-4. Premium field |
| `marginRight` | number | No | The right margin of the PDF in inches from 0 to 4 (e.g., 0.4). default 0.4. range 0-4. Premium field |
| `marginBottom` | number | No | The bottom margin of the PDF in inches from 0 to 4 (e.g., 0.4). default 0.4. range 0-4. Premium field |
| `marginLeft` | number | No | The left margin of the PDF in inches from 0 to 4 (e.g., 0.4). default 0.4. range 0-4. Premium field |
| `landscape` | boolean | No | Set to true for landscape orientation. default false. Premium field |
| `format` | string | No | Paper size. default A4. One of: A4, Letter, Legal, Tabloid, Ledger, A3, A5, A6. Premium field |
| `printBackground` | boolean | No | Print background colors and images; set false for an ink-saving document. default true. Premium field |

## Response fields

- `marginLeft` — string · Left margin of generated PDF in inches
- `marginRight` — string · Right margin of generated PDF in inches
- `marginTop` — string · Top margin of generated PDF in inches
- `marginBottom` — string · Bottom margin of generated PDF in inches
- `landscape` — boolean · PDF orientation mode (true for landscape)
- `format` — string · Paper size used · (premium)
- `pageCount` — number · Number of pages in the generated PDF; null if it could not be read · (premium)
- `pdfName` — string · Generated PDF filename with unique identifier
- `expires` — number · PDF expiration timestamp in milliseconds
- `url` — string · Original source URL that was converted to PDF
- `downloadURL` — string · Temporary signed URL for downloading the PDF file

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "marginLeft": "0.4in",
    "marginRight": "0.4in",
    "marginTop": "0.4in",
    "marginBottom": "0.4in",
    "landscape": false,
    "format": "A4",
    "pageCount": 6,
    "pdfName": "128deceb-c515-444b-8863-82cb3f6ba632.pdf",
    "expires": 1766097122116,
    "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts",
    "downloadURL": "https://storage.googleapis.com/apiverve-helpers.appspot.com/websitetopdf/128deceb-c515-444b-8863-82cb3f6ba632.pdf?GoogleAccessId=1089020767582-compute%40developer.gserviceaccount.com&Expires=1766097122&Signature=LI747FKqKj5i5TYX3KIoVy%2FHgXsLOSXfVEUM0Ekqz2SiiYOZWuk3Of7QBDUklSrcbjiHV0AjbzFTKt6oDU83UkN282HbmhxwrolN6v1Zb9twVi1y7gmTpapCiJi%2BpA1r89ioe%2Fe0%2FV7KrIWaqsorzpdJrnMqe2izMWBaZq%2FYkSO2qlwSyhg2R8EsfxYNAANtd%2FuNS0RuIzqTdhNCiTrRirnDAKS3dMCySQJRznHFnyqzNj1OXwVjvdpSMn9XhWCUa%2FDRR8q%2BE9B0yF8eTvIrDSe2OzJT%2FJLc9rxcLfXAny21gtNqrzMJPU4yM9Ge%2BEbepmDnNZf9xpODNsnq5eLF0g%3D%3D"
  }
}
```

## Use cases

- **Billing Receipt Archival** — SaaS platforms pass payment confirmation URLs to provide customers with downloadable PDF receipts via the temporary download link.
- **Article Offline Reading** — To preserve online research, bookmarking tools submit article URLs and save the resulting PDF download links for offline reading.
- **Policy Compliance Tracking** — When terms of service update, legal teams generate timestamped PDF records directly from live policy pages for compliance archives.
- **Automated Report Exports** — Archive public analytics dashboards by converting page URLs into PDF files to attach to scheduled client reports.

## SDKs

- **npm** — `npm install @apiverve/websitetopdf` (https://www.npmjs.com/package/@apiverve/websitetopdf)
- **PyPI** — `pip install apiverve-websitetopdf` (https://pypi.org/project/apiverve-websitetopdf/)
- **NuGet** — `dotnet add package APIVerve.API.WebsitetoPDF` (https://www.nuget.org/packages/APIVerve.API.WebsitetoPDF)
- **Source** — https://github.com/apiverve/websitetopdf-api

## More

- Full reference: https://docs.apiverve.com/ref/websitetopdf
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
