HTML to PDF API

Send HTML.
Get a perfect PDF.

A single API endpoint that turns your HTML into a pixel-perfect PDF. No headless browser to manage, no dependencies to install, no infrastructure to maintain.

request.js
const response = await fetch('https://api.docforge.io/render', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    html: '<h1>Hello, PDF.</h1>'
  })
})

const { pdf, pages } = await response.json()
// pdf = base64-encoded PDF ready to save or serve
Three steps. That's it.
Build your HTML however you want. We handle the rendering, and the PDF generation.
1

Build your HTML

Use your existing templates, CSS, and layout. Inline your styles or reference external fonts. DocForge renders exactly what you send.

2

POST to the API

Send your HTML to a single endpoint with your API key. Optionally configure paper size, margins, orientation, and headers/footers.

3

Get your PDF

Receive a base64-encoded PDF in the response body, along with page count, file size, and render time. Decode and serve or store.

Built for developers who have better things to do.
No SDKs. No config files. No Chromium binary to package. One endpoint, one response, done.

Pixel-Perfect Rendering

Powered by headless Chromium. What you see in a browser is what you get in the PDF. CSS backgrounds, web fonts, page breaks — all supported.

Any Paper Format

Letter, Legal, A4, Tabloid, or custom dimensions. Portrait or landscape. Full-bleed or custom margins. You control the output.

Fast

Warm renders complete in under a second. Cold starts under 4 seconds. No queues, no webhooks, no polling — synchronous request/response.

Zero Infrastructure

No Chromium to install, no Puppeteer to configure, no container to deploy. You send HTML over HTTPS. We handle the rest.

External Resources

Reference Google Fonts, CDN-hosted images, and external stylesheets in your HTML. DocForge fetches and renders them during conversion.

Simple Auth

One API key in the x-api-key header. No OAuth flows, no tokens to refresh, no SDKs required.

Simple, predictable pricing.
Buy credits upfront. Use them whenever. No subscriptions, no expiration.

Starter

$10
$0.01 per render
1,000 renders
  • All paper formats and orientations
  • Up to 6MB input / 6MB output
  • External fonts and images
  • Credits never expire
Get Started

Scale

$500
$0.005 per render
100,000 renders
  • Everything in Starter
  • 50% savings per render
  • Credits never expire
Get Started
Get your API key.
Enter your email and we'll send you an API key. Start generating PDFs in minutes.