Skip to content
Browse all functions

HTML to PDF – Create PDF from HTML or URL

files/html2pdf

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.

5 credits per callHTTP APIMake

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.

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

Try it in the 1001fx app

Run html2pdf in your browser with your API key – fill the form, click Run and get the answer or the file.

html2pdf in the 1001fx app: the form with example values
HTML to PDF – Create PDF from HTML or URL in the 1001fx app

Endpoint

POSThttps://api.1001fx.com/files/html2pdf
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
application/json

Parameters

  • htmlstringoptional

    HTML of the page. Either html or url.

    Example:
    <h1 style="font-family:sans-serif">Offer 2026-117</h1><p>Thank you for your request.</p>
  • urlstringoptional

    Public web page to print. Either html or url.

  • formatenumoptional

    Default A4.

    Values:
    A3
    A4
    A5
    Letter
    Legal
    Tabloid
    Default:
    A4
  • landscapebooleanoptional
    Default:
    false
  • marginstringoptional

    CSS length for all sides, e.g. 1cm (default), 10mm, 0.

    Default:
    1cm
  • printBackgroundbooleanoptional

    Background colors and images (default true).

    Default:
    true

Examples

HTML to PDF – Create PDF from HTML or URL

HTML to PDF – Create PDF from HTML or URL

Input

Expects a json body
{
  "html": "<h1 style=\"font-family:sans-serif\">Offer 2026-117</h1><p>Thank you for your request.</p>",
  "format": "A4"
}

Output · HTTP 200

Response
{
  "statusCode": 200
}
Show curl command
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"}'

Frequently asked questions

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.

Use cases

Try html2pdf now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.001.11.2026created
Ask 1001fx