Jump to content

Make a PDF

Any web page, or a text your agent wrote, as a PDF file.

Send a link to a web page and your agent gets it back as a PDF file. It can also send its own HTML or Markdown, like a report it wrote. Markdown comes out in a clean, simple style. You pick the paper size and whether the page is tall or wide. A header and a footer can show the page number on every page.

Paste this into your AI agent

Set up Chab for me: fetch https://www.chab.ai/agent-setup.md?v=497c0f and follow it. Then use Chab to turn https://en.wikipedia.org/wiki/Espresso into an A4 PDF with page numbers at the bottom.

Your agent connects Chab and then runs it. Price: 2 credits per started 30 seconds in the browser. The free credits cover a first try. How it works in each app

Full reference for developers
Returns
JSON result and a file
REST endpoint
POST /v1/convert/to-pdf
Over MCP
Call chab_operation_start with "convert.to_pdf"

What you get

Example request

{  "url": "https://www.python.org/",  "page_size": "A4",  "footer_html": "<div style=\"text-align:center;width:100%\">Page {page} of {pages}</div>"}

Example result

{  "data": {    "result": {      "source": { "type": "url", "url": "https://www.python.org/" },      "title": "Welcome to Python.org",      "page_count": 3,      "page_size": "A4",      "landscape": false,      "page_range": null,      "filename": "welcome-to-python-org.pdf",      "mime_type": "application/pdf",      "byte_size": 161697,      "browser_seconds": 4.5,      "primary_artifact_role": "rendered_pdf"    },    "artifacts": [      {        "id": "art_...",        "type": "pdf",        "role": "rendered_pdf",        "mime_type": "application/pdf",        "byte_size": 161697,        "filename": "welcome-to-python-org.pdf",        "download_url": "/v1/operations/op_.../artifacts/art_.../download"      }    ],    "warnings": [],    "result_expires_at": "2026-11-19T19:47:40+00:00"  },  "meta": {    "request_id": "req_123"  }}

Inputs

FieldTypeDetails
urlstringA public web page to print. It is checked like screenshots.url: no private or local addresses.Up to 2048 characters
htmlstringYour own HTML page, up to 500,000 bytes, with its styles and scripts. Images and stylesheets load from public https addresses or data: URLs; requests to private addresses and local files are refused.
markdownstringMarkdown, up to 500,000 bytes, set in a clean default style (GitHub style tables, task lists and code blocks). Its first heading becomes the PDF title. HTML inside the Markdown works too; scripts do not run.
page_sizestringOne of A4, Letter, Legal, A3, A5. Default "A4"
landscapebooleanDefault false
marginsobjectOne length for all four sides, or top, right, bottom and left. Default 10mm, and 20mm at the top or bottom when there is a header or footer.
scalenumberZoom of the page content, such as 0.8 to fit more on a page.Default 1. Min 0.1 max 2
print_backgroundbooleanPrint background colors and images.Default true
header_htmlstringHTML at the top of every page, in small grey text. {page}, {pages}, {date}, {title} and {url} become the page number, the page count, the date, the title and the address. Images must be data: URLs.Up to 10000 characters
footer_htmlstringHTML at the bottom of every page, like header_html, such as "Page {page} of {pages}".Up to 10000 characters
wait_untilstringnetworkidle waits until the page has stopped loading (at most 2 open requests for half a second); load prints as soon as the page and its images have loaded.One of networkidle, load. Default "networkidle"
wait_for_selectorstringA CSS selector to wait for (up to 15 seconds) before printing, such as a chart that a script draws.Up to 500 characters
page_rangestringOnly these pages, such as "1-3, 5". Default: all pages.Up to 100 characters

How to call it

AI apps use it through hosted MCP. Coding agents can also use the CLI, and your own code can call the API. Each call starts a job, and your agent picks up the result when it is ready.

curl -X POST https://www.chab.ai/v1/convert/to-pdf \  -H "Authorization: Bearer CHAB_API_KEY" \  -H "Content-Type: application/json" \  -H "Idempotency-Key: convert-to-pdf-001" \  -d '{"url":"https://www.python.org/","page_size":"A4","footer_html":"<div style=\"text-align:center;width:100%\">Page {page} of {pages}</div>"}'

Make a PDF result

{  "data": {    "result": {      "source": { "type": "url", "url": "https://www.python.org/" },      "title": "Welcome to Python.org",      "page_count": 3,      "page_size": "A4",      "landscape": false,      "page_range": null,      "filename": "welcome-to-python-org.pdf",      "mime_type": "application/pdf",      "byte_size": 161697,      "browser_seconds": 4.5,      "primary_artifact_role": "rendered_pdf"    },    "artifacts": [      {        "id": "art_...",        "type": "pdf",        "role": "rendered_pdf",        "mime_type": "application/pdf",        "byte_size": 161697,        "filename": "welcome-to-python-org.pdf",        "download_url": "/v1/operations/op_.../artifacts/art_.../download"      }    ],    "warnings": [],    "result_expires_at": "2026-11-19T19:47:40+00:00"  },  "meta": {    "request_id": "req_123"  }}

Price: 2 credits per started 30 seconds in the browser. See all prices

Want to try Chab with your agent?

Copy the prompt and paste it into your AI. Your agent starts with free credits and doesn't need an account.

See plans