1.1.2 • Published 5 months ago

invoice-generator-pdf v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Invoice Generator PDF

npm version

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": "me@example.com",
    "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

npm install invoice-generator-pdf
yarn add invoice-generator-pdf
pnpm add invoice-generator-pdf
deno install jsr:@mandeindjs/invoice-generator-pdf

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",
);
1.1.2

5 months ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago