Convert HTML to PDF without leaving the browser
This playground runs the same synchronous PDF generation path used by the Fork PDF API. Paste a document, add print CSS, and optionally run JavaScript before printing. The generated PDF is returned directly to your browser.
How it works
- Paste your source. Use the HTML, CSS, JavaScript, Template data, and Test case tabs.
- Choose output options. Select PDF or ZIP, a standard or custom page size, per-side margins, media type, a compliance preset, and a font policy.
- Generate and download. The selected region renders the PDF and returns it directly. No PDF record is stored.
Template data and synchronous self-healing
The Template data tab accepts a JSON object. The HTML uses Nunjucks placeholders such as {{ company }} and {{ item.amount }}, so one document can generate many variants without editing the markup. The Test case tab runs after layout with the spatial document available as doc. Return { success: true } to accept the PDF, or return a patch object to merge new values into the template data and re-render. The engine retries twice, synchronously, before returning an error.
Demo vs API
Use the same example with the API
The API supports the same synchronous request with an API key and project ID, plus webhooks, templates, and stored PDFs.
curl -X POST "https://api.forkpdf.com/v1/generate-pdf" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-project-id: YOUR_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"htmlContent": "<h1>Hello from Fork PDF</h1>",
"format": "A4",
"compliance": { "pdfUa": 2 }
}'
const response = await fetch('https://api.forkpdf.com/v1/generate-pdf', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'x-project-id': 'YOUR_PROJECT_ID',
'Content-Type': 'application/json'
},
body: JSON.stringify({
htmlContent: '<h1>Hello from Fork PDF</h1>',
format: 'A4',
compliance: { pdfUa: 2 }
})
});
Free demo limits
The browser tool allows 5 generations per IP address every 24 hours. The per-IP window is rolling: it starts with your first generation. No signup or API key is required for the demo.
What happens to my HTML?
The demo sends your HTML, CSS, and JavaScript to the selected Fork PDF generation region and returns the PDF or ZIP directly. It does not create a PDF record, does not store the output, and does not send the request through the authenticated API queue path.
Frequently asked questions
Is the HTML to PDF converter really free?
Yes. The demo is free without an account. The 5-per-IP limit keeps it available.
Why is there a limit?
PDF generation uses a headless browser and consumes compute. The limit protects the demo from abuse and keeps it free.
Does JavaScript run?
Yes. The JavaScript tab runs in the PDF engine before generation. Keep scripts self-contained and deterministic.
Does it support template data and self-healing?
Yes. Add a JSON object in the Template data tab and use Nunjucks placeholders in the HTML. The Test case tab runs after layout; return { success: true }, or { success: false, patch: { ... } } to patch the template data and re-render synchronously.
Can I use the API instead?
Yes. The API supports the same synchronous generation model plus webhooks, templates, and project storage. See the generate PDF API reference and the compliance capability matrix.
Can I generate PDF/A or PDF/UA?
Yes. Choose PDF/A-2/3/4, PDF/UA-1/2, or a supported combination in the Compliance selector. PDF/A is stable and machine-validated. PDF/UA remains experimental until the human accessibility audit.
What is strict font policy?
Strict font policy rejects external stylesheets, non-inline @font-face rules, and system-font fallback. Use it when every glyph must come from a caller-supplied inline font. The default warn policy reports warnings without blocking generation.
Does the demo store my document?
No. The demo returns the generated file directly and does not store the PDF. Rate limiting stores only a salted IP hash and counters.
Can I set custom page sizes and margins?
Yes. Choose a standard page size or enter custom width and height. Each margin can use millimetres, centimetres, inches, or pixels.
What is the difference between the demo and the API?
The demo is a synchronous browser playground with no signup. The API adds API keys, projects, templates, higher limits, webhooks, and stored PDFs.
Related documentation