Practical examples of generating PDFs with the PDFBolt API.
To run them you need a PDFBolt API key. Create a free account at pdfbolt.com to get one.
This example creates an invoice PDF using Node.js, EJS templates (HTML with placeholders for dynamic content), and the PDFBolt API. You fill the template with your data and send it to the API, which returns the PDF.
pdfbolt-examples/
├── invoice-pdf-generator/
│ ├── data/ // JSON data
│ │ └── invoice-data.json // Invoice data for placeholders
│ ├── templates/ // HTML templates
│ │ └── invoice.ejs // EJS template for the invoice
│ ├── generate-pdf.js // Script that generates the PDF
│ └── package.json // Project configuration
git clone https://github.com/pdfbolt/pdfbolt-examples.gitcd invoice-pdf-generatorMake sure Node.js is installed, then run:
npm installOpen generate-pdf.js and replace the placeholder with your PDFBolt API key.
node generate-pdf.jsThe PDF is saved in the invoice-pdf-generator directory as:
invoice-<timestamp>.pdf
For a detailed walkthrough, see How to Generate Invoice PDFs with an API.
For more PDF generation examples and tutorials, see the PDFBolt blog.
