HR
Payslip PDF generator API
A clear monthly salary slip with earnings, deductions and net pay — generated in bulk every pay run.
Run payroll and hand every employee a clear PDF payslip without designing one by hand. Pass the company, employee, earnings and deductions, and PDFgen returns a tidy slip with net pay calculated into the layout.
Loop over your payroll list to produce hundreds of payslips per run, each personalised, from one reusable template.
Generate a Payslip PDF via the API
POST your data to /api/v1/generate and get a PDF back. Copy-paste an example, swap in your API key, and loop over a list to render thousands — one payslip per record.
curl -X POST https://pdfgen.com/api/v1/generate \-H "Authorization: Bearer pdfg_live_xxx" \-H "Content-Type: application/json" \-d '{"html": "<div style=\"max-width:680px;margin:0 auto;padding:44px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\">\n <div style=\"display:flex;justify-content:space-between;align-items:flex-start;border-bottom:2px solid #111827;padding-bottom:16px;margin-bottom:24px;\">\n <div>\n <h1 style=\"font-size:20px;font-weight:800;margin:0;\">{{company.name}}</h1>\n <p style=\"color:#6b7280;margin:4px 0 0;font-size:13px;\">{{company.address}}</p>\n </div>\n <div style=\"text-align:right;\">\n <h2 style=\"font-size:16px;letter-spacing:2px;color:#4f46e5;margin:0;font-weight:800;\">PAYSLIP</h2>\n <p style=\"margin:6px 0 0;color:#6b7280;font-size:13px;\">{{period}}</p>\n </div>\n </div>\n <div style=\"display:flex;justify-content:space-between;margin-bottom:24px;font-size:13px;\">\n <div>\n <p style=\"font-size:11px;text-transform:uppercase;letter-spacing:1px;color:#9ca3af;margin:0 0 4px;\">Employee</p>\n <p style=\"margin:0;font-weight:600;\">{{employee.name}}</p>\n <p style=\"margin:2px 0 0;color:#6b7280;\">{{employee.title}}</p>\n </div>\n <div style=\"text-align:right;\">\n <p style=\"font-size:11px;text-transform:uppercase;letter-spacing:1px;color:#9ca3af;margin:0 0 4px;\">Employee ID</p>\n <p style=\"margin:0;font-weight:600;\">{{employee.id}}</p>\n <p style=\"margin:2px 0 0;color:#6b7280;\">Pay date {{formatDate payDate}}</p>\n </div>\n </div>\n <div style=\"display:flex;gap:24px;\">\n <div style=\"flex:1;\">\n <h3 style=\"font-size:12px;text-transform:uppercase;letter-spacing:1px;color:#16a34a;margin:0 0 8px;\">Earnings</h3>\n <table style=\"width:100%;font-size:13px;border-collapse:collapse;\">\n {{#each earnings}}<tr><td style=\"padding:6px 0;border-bottom:1px solid #f3f4f6;\">{{label}}</td><td style=\"padding:6px 0;border-bottom:1px solid #f3f4f6;text-align:right;\">{{formatCurrency amount ../currency}}</td></tr>{{/each}}\n </table>\n </div>\n <div style=\"flex:1;\">\n <h3 style=\"font-size:12px;text-transform:uppercase;letter-spacing:1px;color:#dc2626;margin:0 0 8px;\">Deductions</h3>\n <table style=\"width:100%;font-size:13px;border-collapse:collapse;\">\n {{#each deductions}}<tr><td style=\"padding:6px 0;border-bottom:1px solid #f3f4f6;\">{{label}}</td><td style=\"padding:6px 0;border-bottom:1px solid #f3f4f6;text-align:right;\">{{formatCurrency amount ../currency}}</td></tr>{{/each}}\n </table>\n </div>\n </div>\n <div style=\"display:flex;justify-content:space-between;align-items:center;background:#111827;color:#fff;padding:16px 24px;border-radius:10px;margin-top:28px;\">\n <span style=\"font-size:14px;\">Net pay</span>\n <span style=\"font-size:22px;font-weight:800;\">{{formatCurrency netPay currency}}</span>\n </div>\n</div>","engine": "handlebars","format": "A4","data": {"company": {"name": "Northwind Studio","address": "120 Market St, San Francisco, CA"},"period": "June 2026","employee": {"name": "Jordan Avery","title": "Senior Product Designer","id": "EMP-0241"},"payDate": "2026-06-30","currency": "USD","earnings": [{"label": "Basic salary","amount": 6500},{"label": "Housing allowance","amount": 800},{"label": "Performance bonus","amount": 500}],"deductions": [{"label": "Income tax","amount": 1420},{"label": "Health insurance","amount": 210},{"label": "Retirement 401(k)","amount": 390}],"netPay": 6780}}' --output payslip.pdf
Working in another language? Follow a full guide for your stack:
What you can build
- Generating a payslip for every employee each pay cycle
- Bundling payslips into an HR or self-service portal
- Producing year-end pay summaries from the same data
- Localising slips per country with template variants
Frequently asked questions
- Can I generate every employee’s payslip at once?
- Yes — loop over your payroll records and call /api/v1/generate for each. You get one PDF per employee, ready to email or store.
- Does it handle earnings and deductions tables?
- Yes. Pass earnings and deductions as arrays and the template renders both columns; net pay is shown in the highlighted footer.
- Is employee data stored?
- The render is stateless — you pass data per request and receive the PDF back. Use your own storage, or PDFgen’s expiring links / self-storage options.