invoice-generator-pdf
v1.1.0
Published
Generate PDF invoice using PDFMake from JSON definition.
Downloads
18
Readme
Invoice Generator PDF
Generate PDF invoice using PDFMake from JSON definition.
You need to defined as a JSON file like this example
{
"id": "INVOICE-0001",
"me": {
"name": "Jean L'astuce",
"address": "1 rue des Lilas, 69001, Lyon",
"phone": "+336123456",
"email": "[email protected]",
"website": "https://example.com"
},
"recipient": { "name": "ACME", "address": "1 avenue des Champs Elysée, 75001, Paris" },
"fromDate": "2024-06-10",
"toDate": "2024-07-07",
"issueDate": "2024-07-11T08:18:45.748Z",
"items": [
{ "name": "Software development - 2024 W25", "hours": 9.5 },
{ "name": "Software development - 2024 W26", "hours": 8 },
{ "name": "Software development - 2024 W27", "hours": 7.6 }
],
"pricePerHour": 50,
"bankInformations": "BIC: ABC1234 | IBAN: FR12 1234 1234 1234 1234 1234 123"
}
It will generate a PDF like the following example.
You can check the complete JSON schema here.
Usage
CLI
invoice-generator-pdf example.json
# or for local testing
npm run cli example.json
API
import { exportToPDF } from "invoice-generator-pdf";
await exportToPDF(
{
/* your conf */
},
"./out.pdf"
);