# html2pdf: HTML to PDF – Create PDF from HTML or URL

> html2pdf (HTML to PDF – Create PDF from HTML or URL) is a 1001fx API function in the group Files & PDF: POST https://api.1001fx.com/files/html2pdf, 5 credits per call. It works as a ready-made module in Make or as a plain HTTP call.

Creates a PDF from HTML or from a web page (URL) with Chromium, like printing in the browser: CSS, web fonts and images included. Paper format, orientation, margins and backgrounds can be set.

- Group: Files & PDF
- Endpoint: `POST https://api.1001fx.com/files/html2pdf`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: application/json
- Credits: 5 credits per call
- Ready-made in: Make
- Docs: https://1001fx.com/functions/html2pdf

## Parameters

- `html` (string, optional) – HTML: HTML of the page. Either html or url.
- `url` (string, optional) – URL: Public web page to print. Either html or url.
- `format` (enum, optional, one of `A3`, `A4`, `A5`, `Letter`, `Legal`, `Tabloid`, default `A4`) – Paper format: Default A4.
- `landscape` (boolean, optional, default `false`) – Landscape
- `margin` (string, optional, default `1cm`) – Margin: CSS length for all sides, e.g. 1cm (default), 10mm, 0.
- `printBackground` (boolean, optional, default `true`) – Print backgrounds: Background colors and images (default true).

## Use cases

- Create offers and invoices as PDF from an HTML template in Make or n8n
- Save a web page as PDF for an archive or a compliance record
- Turn an HTML report that a workflow builds into a PDF attachment

## Example: HTML to PDF – Create PDF from HTML or URL

```bash
curl -X POST 'https://api.1001fx.com/files/html2pdf' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"html":"<h1 style=\"font-family:sans-serif\">Offer 2026-117</h1><p>Thank you for your request.</p>","format":"A4"}'
```

## FAQ

**Can I convert a web page instead of HTML?**

Yes. Pass either html or the public url of the page. The page is rendered with Chromium like printing in the browser, including CSS, web fonts and images.

**Which page settings can I change?**

Paper format (A4 by default), landscape, margin as CSS length (1cm by default) and whether backgrounds are printed (on by default).

**How do I use it in Make or n8n?**

Call it with an HTTP request: POST to the endpoint with your API key in the X-API-KEY header and a JSON body. The answer is the PDF file.
