Documentation Index
Fetch the complete documentation index at: https://docs.getdocuforge.dev/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Get from zero to a generated PDF in 5 minutes.
1. Get an API Key
Sign up at app.getdocuforge.dev and copy your API key from the dashboard. It starts with df_live_.
2. Install the SDK
3. Generate Your First PDF
import { DocuForge } from 'docuforge';
const df = new DocuForge(process.env.DOCUFORGE_API_KEY);
const pdf = await df.generate({
html: `
<h1>Hello from DocuForge</h1>
<p>This took 30 seconds, not 3 days.</p>
`,
options: { format: 'A4' }
});
console.log(pdf.url);
4. Use Templates
Create a reusable template and merge data on each call:
// Create a template
const template = await df.templates.create({
name: 'Invoice',
html_content: `
<h1>Invoice for {{company}}</h1>
<table>
{{#each items}}
<tr>
<td>{{description}}</td>
<td>{{qty}} × ${{rate}}</td>
</tr>
{{/each}}
</table>
<h2>Total: ${{total}}</h2>
`
});
// Generate from template
const pdf = await df.fromTemplate({
template: template.id,
data: {
company: 'Acme Corp',
items: [{ description: 'Consulting', qty: 10, rate: 150 }],
total: 1500
}
});
const pdf = await df.generate({
html: invoiceHTML,
options: {
format: 'A4',
margin: { top: '1in', bottom: '1in', left: '0.75in', right: '0.75in' },
header: '<div style="font-size:10px;text-align:center">Acme Corp</div>',
footer: '<div style="font-size:10px;text-align:center">Page {{pageNumber}} of {{totalPages}}</div>'
}
});
Next Steps