apyhub
FILE CONVERSION · SMART GENERATION

Convert and Format raw HTML to PDF API

What it does

HTML to PDF turns raw HTML into a downloadable PDF file. Send your HTML in the html field and get back binary PDF output that you can store, email, or stream to users.

Use the optional layout fields to control the document output: landscape for page orientation, page_size for A4, Letter, Legal, A3, or Tabloid, and margin_top, margin_left, margin_right, and margin_bottom for CSS-based page margins. You can also set print_background to include background graphics in the rendered PDF.

HTML to PDF is a practical fit for invoice generation, report export, receipts, and any workflow where you already have HTML templates and need a printable document. Because the input is raw HTML, you can render the same content your app shows in the browser and convert it into a file for download or archival use.

It accepts HTML content up to 5,000,000 characters, making it suitable for large pages and generated documents with substantial markup.

POST
PDF from HTML
https://api.eu.apyverse.com/chisleroff/pdf-from-html

QUICKSTART

GUIDE

Quickstart

Convert a snippet of HTML into a PDF with the required html field.

curl -X POST "https://api.eu.apyverse.com/chisleroff/pdf-from-html" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"html":"<html><body><h1>Hello, PDF</h1></body></html>"}'

What you'll get back

Returns a binary PDF file as the response body.

TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Raw HTML content to convert to PDF (max 5,000,000 characters).
Page orientation: true for landscape, false for portrait.
Page size: A4, Letter, Legal, A3, Tabloid.
Top margin with CSS units.
Left margin with CSS units.
Right margin with CSS units.
Bottom margin with CSS units.
Print background graphics.

About this endpoint

What it does

Converts raw HTML into a PDF document. You send the HTML and optional page setup options in the request body, and the endpoint returns the generated PDF as binary content.

Request Body

ParameterTypeMandatoryDescription
htmlStringYesRaw HTML content to convert to PDF. Maximum 5,000,000 characters.
landscapeBooleanNoPage orientation. true for landscape, false for portrait. Default: false.
page_sizeStringNoPage size. Allowed values: A4, Letter, Legal, A3, Tabloid. Default: A4.
margin_topStringNoTop margin with CSS units. Default: 10mm.
margin_leftStringNoLeft margin with CSS units. Default: 10mm.
margin_rightStringNoRight margin with CSS units. Default: 10mm.
margin_bottomStringNoBottom margin with CSS units. Default: 10mm.
print_backgroundBooleanNoPrint background graphics. Default: true.

Response

Returns a binary response containing the generated PDF document. The output schema is a single String with binary format, so the success payload is the PDF file itself rather than a JSON object.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.