---
title: Convert and Format raw HTML to PDF API
slug: pdf-from-html
url: https://apyhub.com/chisleroff/service/pdf-from-html
provider: Website Intelligence
categories: [File Conversion, File Manipulation, Smart Generation]
tags: [html, pdf, raw, format]
auth: api_key
---

# Convert and Format raw HTML to PDF API

Convert raw HTML into a PDF file with page size, margins, orientation, and background control. Useful for invoices, reports, and document exports.

## Endpoints

| Method | Path | Description | Atoms |
| --- | --- | --- | --- |
| POST | `/chisleroff/pdf/from-html` | What it does Converts raw HTML into a PDF document. You send HTML plus optional page and margin set… | 100 |

## About

## What it does
HTML to PDF turns raw HTML into a PDF binary you can store, email, or attach to workflows. Send an HTML document in the required `body.html` field, and the response comes back as a PDF file.

Use the optional page settings to control how the document is rendered. You can switch between portrait and landscape with `landscape`, choose a paper format with `page_size` (`A4`, `Letter`, `Legal`, `A3`, or `Tabloid`), and tune the margins with `margin_top`, `margin_left`, `margin_right`, and `margin_bottom`. Set `print_background` when you need background colors and graphics preserved in the output.

This is a fit for invoice generation, report export, contract snapshots, and any workflow where HTML is already the source of truth. Build the page once in your app, send the rendered markup to HTML to PDF, and return a downloadable PDF without a manual print step.

Because the output is a binary PDF, it can slot directly into document pipelines, storage systems, or delivery jobs that expect a file rather than JSON.

## Usage

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/chisleroff/service/pdf-from-html
