โšก PDFGen

Upload HTML templates โ†’ Get PDF generation API endpoints instantly

๐Ÿ“‹ My Templates

๐Ÿ“ญ

No templates yet

๐Ÿ‘ˆ

Select a template to view details

Or upload a new one to get started

๐Ÿ“ค Upload HTML Template

Upload an HTML file with {{variable}} Handlebars placeholders. PDFGen will parse it and create a dedicated PDF generation API endpoint.

๐Ÿ“„

Drop your HTML file here or click to browse

๐Ÿงช Test PDF Generation

๐Ÿ‘ Live Preview

Select a template and click Preview

๐Ÿš€ How PDFGen Works

1

Upload HTML

Upload an HTML file with {{variable}} Handlebars placeholders for dynamic content.

2

Get Schema

PDFGen parses your template and generates a JSON payload schema showing all required variables.

3

Call API

POST your data to the generated endpoint. PDFGen renders the HTML with your data.

4

Get PDF

Receive a pixel-perfect PDF generated from your rendered HTML template via headless Chrome.

๐Ÿ“š API Reference

๐Ÿ“ก Endpoints
GET /api/templates โ€” List all templates POST /api/templates โ€” Upload new template (multipart: html file + name) GET /api/templates/:slug โ€” Get template details, schema & sample payload POST /api/templates/:slug/generate โ€” Generate PDF (JSON body = template data) POST /api/templates/:slug/preview โ€” Preview rendered HTML DEL /api/templates/:slug โ€” Delete a template GET /healthz โ€” Health check
โš™๏ธ PDF Options (query params on /generate)
?format=A4|Letter|Legal|A3 &landscape=true|false &marginTop=10mm &marginBottom=10mm &marginLeft=10mm &marginRight=10mm
โœ๏ธ Template Syntax (Handlebars)
Simple variable: {{companyName}} Nested object: {{address.city}} Loop: {{#each items}} ... {{name}} ... {{/each}} Conditional: {{#if showDiscount}} ... {{/if}}
๐Ÿ’ป Quick Start Example
# 1. Upload a template curl -X POST /api/templates \ -F "html=@invoice.html" \ -F "name=Invoice" # 2. Generate a PDF curl -X POST /api/templates/invoice/generate \ -H "Content-Type: application/json" \ -d '{"companyName":"Acme","invoiceNumber":"INV-001"}' \ --output invoice.pdf