Skip to content
HALOWERK

Formatwerk

html to pdf

Prints HTML/CSS with headless Chrome 148 (puppeteer-core) in a fresh incognito context per call. Scripts in the document are disabled and every network request is blocked (only inline and data: resources), so no foreign URL is fetched; blocked requests are counted. Page size (ISO A3-A5, Letter, Legal, custom or CSS @page), margins, landscape, scale, page ranges, bookmarks, header/footer with {page}/{pages}/{title}/{date}. Limits: 3 MB HTML, 500 pages, 30 MB PDF.

POST https://format.halowerk.com/v1/html-to-pdf

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
htmlstringYesHTML document or fragment; embed images/fonts as data: URLs.
page_sizestringNo
width_mmnumberNoCustom page width; requires height_mm.
height_mmnumberNoCustom page height; requires width_mm.
landscapebooleanNo
margin_mmobjectNoPage margins in millimetres.
headerobjectNoPlain text; placeholders {page} {pages} {title} {date}.
footerobjectNoPlain text; placeholders {page} {pages} {title} {date}.
header_footer_font_ptnumberNo
print_backgroundbooleanNo
prefer_css_page_sizebooleanNoUse the size from CSS @page rules if present.
mediastringNo
scalenumberNo
page_rangesstringNoPages to print, e.g. "1-3,5".
outlinebooleanNoAdd PDF bookmarks generated from h1–h6.
max_pagesintegerNo
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "html"
  ],
  "properties": {
    "html": {
      "type": "string",
      "minLength": 1,
      "maxLength": 3000000,
      "description": "HTML document or fragment; embed images/fonts as data: URLs."
    },
    "page_size": {
      "type": "string",
      "enum": [
        "A3",
        "A4",
        "A5",
        "Letter",
        "Legal"
      ],
      "default": "A4"
    },
    "width_mm": {
      "type": "number",
      "minimum": 25,
      "maximum": 1000,
      "description": "Custom page width; requires height_mm."
    },
    "height_mm": {
      "type": "number",
      "minimum": 25,
      "maximum": 1000,
      "description": "Custom page height; requires width_mm."
    },
    "landscape": {
      "type": "boolean",
      "default": false
    },
    "margin_mm": {
      "type": "object",
      "additionalProperties": false,
      "description": "Page margins in millimetres.",
      "properties": {
        "top": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "right": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "bottom": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "left": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        }
      }
    },
    "header": {
      "type": "object",
      "additionalProperties": false,
      "description": "Plain text; placeholders {page} {pages} {title} {date}.",
      "properties": {
        "left": {
          "type": "string",
          "maxLength": 200
        },
        "center": {
          "type": "string",
          "maxLength": 200
        },
        "right": {
          "type": "string",
          "maxLength": 200
        }
      }
    },
    "footer": {
      "type": "object",
      "additionalProperties": false,
      "description": "Plain text; placeholders {page} {pages} {title} {date}.",
      "properties": {
        "left": {
          "type": "string",
          "maxLength": 200
        },
        "center": {
          "type": "string",
          "maxLength": 200
        },
        "right": {
          "type": "string",
          "maxLength": 200
        }
      }
    },
    "header_footer_font_pt": {
      "type": "number",
      "minimum": 6,
      "maximum": 14,
      "default": 9
    },
    "print_background": {
      "type": "boolean",
      "default": true
    },
    "prefer_css_page_size": {
      "type": "boolean",
      "default": false,
      "description": "Use the size from CSS @page rules if present."
    },
    "media": {
      "type": "string",
      "enum": [
        "print",
        "screen"
      ],
      "default": "print"
    },
    "scale": {
      "type": "number",
      "minimum": 0.1,
      "maximum": 2,
      "default": 1
    },
    "page_ranges": {
      "type": "string",
      "maxLength": 100,
      "pattern": "^\\d+(-\\d+)?(,\\d+(-\\d+)?)*$",
      "description": "Pages to print, e.g. \"1-3,5\"."
    },
    "outline": {
      "type": "boolean",
      "default": false,
      "description": "Add PDF bookmarks generated from h1–h6."
    },
    "max_pages": {
      "type": "integer",
      "minimum": 1,
      "maximum": 500,
      "default": 200
    }
  }
}

Open original schema

Published input example

{
  "html": "<h1>Delivery note 4711</h1><p>2 × pressure sensor</p>",
  "page_size": "A4",
  "footer": {
    "right": "Page {page} of {pages}"
  }
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub →