Quick Start
1. Register to printerz
Register to printerz and confirm your email address.
2. Pick your plan
Once registered pick the plan that fits your needs. (You can start with the free plan)
3. Grab an API key
You can get or generate an API key in your printerz dashboard (opens in a new tab).
4. Create your first template
Create and upload your first template. If you don't have any template yet, you can check this tutorial to create your first template. Or you can grab one example from this repo (opens in a new tab)
5. Get your template id
You can find your template id in your printerz dashboard (opens in a new tab).
6. Render your template
In order to render your template as a PDF you will simply need to hit our API endpoint at
POST - https://api.printerz.dev/templates/{templateId}/render
import { writeFile } from "node:fs/promises"
const options = {
method: 'POST',
headers: { 'x-api-key': 'sk_your_api_key', 'Content-Type': 'application/json' },
body: JSON.stringify({
variables: {
"some": "variables"
},
options: {
"printBackground": true
}
})
};
const templateId = 'your-template-id';
const response = await fetch(`https://api.printerz.dev/templates/${templateId}/render`, options);
if(!response.ok) {
throw new Error(response.statusText);
}
const pdfBuffer = await response.arrayBuffer();
await writeFile('output.pdf', Buffer.from(pdfBuffer));