Production-ready API for invoices, reports, certificates, OG images, and more. From HTML to pixel-perfect documents in milliseconds.
No credit card required. Free forever.
# Generate a PDF from HTML curl -X POST https://api.docforge.dev/v1/pdf/from-html \ -H "Authorization: Bearer df_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "html": "<h1>Invoice #1042</h1>", "css": "h1 { color: #1a1a2e; }", "format": "A4", "margin": "20mm" }' \ -o invoice.pdf
{ "status": "success", "pages": 1, "size": "24.3 KB", "render_time": "94ms" }
Integrate DocForge in minutes with your favorite language. Clean, intuitive endpoints.
curl -X POST https://api.docforge.dev/v1/pdf/from-html \ -H "Authorization: Bearer df_live_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "html": "<!DOCTYPE html><html><body><div class=\"invoice\"><h1>Invoice #1042</h1><p>Amount: $2,500.00</p><table><tr><td>Web Development</td><td>$2,500.00</td></tr></table></div></body></html>", "css": ".invoice { font-family: Inter; padding: 40px; } h1 { color: #1a1a2e; }", "format": "A4", "margin": "20mm", "printBackground": true }' \ --output invoice.pdf # Response: 200 OK (94ms) - PDF saved to invoice.pdf
const response = await fetch('https://api.docforge.dev/v1/pdf/from-html', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.DOCFORGE_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ html: ` <div class="invoice"> <h1>Invoice #1042</h1> <p>Amount: $2,500.00</p> <table> <tr><td>Web Development</td><td>$2,500.00</td></tr> </table> </div>`, css: '.invoice { font-family: Inter; padding: 40px; }', format: 'A4', margin: '20mm', }), }); const pdf = await response.arrayBuffer(); fs.writeFileSync('invoice.pdf', Buffer.from(pdf));
import requests import os response = requests.post( "https://api.docforge.dev/v1/pdf/from-html", headers={ "Authorization": f"Bearer {os.environ['DOCFORGE_API_KEY']}", "Content-Type": "application/json", }, json={ "html": """ <div class="invoice"> <h1>Invoice #1042</h1> <p>Amount: $2,500.00</p> <table> <tr><td>Web Development</td><td>$2,500.00</td></tr> </table> </div> """, "css": ".invoice { font-family: Inter; padding: 40px; }", "format": "A4", "margin": "20mm", }, ) with open("invoice.pdf", "wb") as f: f.write(response.content)
package main import ( "bytes" "encoding/json" "net/http" "os" ) func main() { payload, _ := json.Marshal(map[string]interface{}{ "html": `<div class="invoice"><h1>Invoice #1042</h1></div>`, "css": ".invoice { font-family: Inter; padding: 40px; }", "format": "A4", "margin": "20mm", }) req, _ := http.NewRequest("POST", "https://api.docforge.dev/v1/pdf/from-html", bytes.NewBuffer(payload)) req.Header.Set("Authorization", "Bearer "+os.Getenv("DOCFORGE_API_KEY")) req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() out, _ := os.Create("invoice.pdf") io.Copy(out, resp.Body) }
<?php $ch = curl_init('https://api.docforge.dev/v1/pdf/from-html'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('DOCFORGE_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'html' => '<div class="invoice"> <h1>Invoice #1042</h1> <p>Amount: $2,500.00</p> </div>', 'css' => '.invoice { font-family: Inter; padding: 40px; }', 'format' => 'A4', 'margin' => '20mm', ]), ]); $pdf = curl_exec($ch); curl_close($ch); file_put_contents('invoice.pdf', $pdf); ?>
Six powerful endpoints covering every document generation use case. Built for developers, designed for production.
Convert any HTML and CSS to pixel-perfect PDF documents. Full support for web fonts, flexbox, grid, and modern CSS.
Generate PNG, JPEG, or WebP images from HTML templates. Perfect for social cards, thumbnails, and dynamic graphics.
Capture any live webpage as a PDF or screenshot. Set custom viewports, wait for JS execution, and handle authentication.
Create reusable templates with {{variable}} interpolation. Store templates server-side and render with dynamic data.
Inject custom CSS, execute JavaScript before capture, set viewports, and control every aspect of the rendering pipeline.
Sub-second rendering powered by optimized Chromium headless instances. Average response time under 100ms for simple documents.
No SDKs to install. No complex configuration. Just a simple REST API call.
POST your HTML and CSS to our API endpoint. Include any styling, scripts, or template variables.
Our Chromium-powered engine renders your content with pixel-perfect accuracy in under 100ms.
Receive your PDF or image in the response body. Stream it, save it, or serve it directly to users.
From invoices to social cards, DocForge handles every document generation scenario.
Generate branded invoices with dynamic line items, tax calculations, and professional layouts.
Create data-rich PDF reports with charts, tables, and visualizations from your analytics data.
Issue personalized certificates with custom designs, signatures, and verification codes.
Dynamically generate Open Graph images for blog posts, products, and social media sharing.
Produce flyers, brochures, and promotional materials with pixel-perfect brand consistency.
Generate contracts, agreements, and compliance documents with proper formatting and pagination.
Generate branded invoices with dynamic line items, tax calculations, and professional layouts.
Create data-rich PDF reports with charts, tables, and visualizations from your analytics data.
Issue personalized certificates with custom designs, signatures, and verification codes.
Dynamically generate Open Graph images for blog posts, products, and social media sharing.
Produce flyers, brochures, and promotional materials with pixel-perfect brand consistency.
Generate contracts, agreements, and compliance documents with proper formatting and pagination.
Start free. Scale as you grow. No hidden fees, no surprises.
We built DocForge to be faster, simpler, and more affordable than the competition.
| Feature | DocForge | CraftMyPDF | PDFShift | Browserless |
|---|---|---|---|---|
| Starting Price | Free / $19/mo | $49/mo | $9/mo | $200/mo |
| Avg Render Speed | ~100ms | ~500ms | ~300ms | ~200ms |
| Template Engine | Yes | Yes | No | No |
| Image Generation | PNG, JPEG, WebP | PNG, JPEG | No | PNG, JPEG |
| Custom CSS/JS | Full support | CSS only | CSS only | Full support |
| Free Tier | 100 renders/mo | No | 50 renders/mo | No |
| URL Capture | Yes | No | Yes | Yes |
Everything you need to know about DocForge. Can't find an answer? Contact our team.
{{variable}} placeholders. When generating a document, pass a JSON object with your variable values and DocForge handles the interpolation. Templates support conditionals, loops, and nested objects. Store unlimited templates on our servers for instant rendering.waitForSelector parameter to ensure dynamic content is fully rendered before capture.<link> tag in your HTML. For custom fonts, include them as base64-encoded @font-face rules in your CSS, or upload them to our CDN for persistent use across all your renders.No setup required. Get your API key and start rendering immediately.
Get Started Free — 100 renders/moFree plan includes 100 renders per month. No credit card required.