mikebrind / minvoice

Minimal PDF invoice generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minvoice

Minvoice is a minimal PDF invoice generation API built using ASP.NET Core. It uses Playwright to convert a rendered HTML template to PDF using Chromium.

Run in Docker

The fastest way to launch Minvoice is via Docker:

docker run -p 5000:5000 --rm -it benfoster/minvoice:latest

Note that the image is quite large (~500MB) due to Playwright's dependencies

You can override the default invoice template with your own HTML file:

docker run --rm -it -p 5000:5000 \
    -v $(pwd)/custom-template.html:/app/invoice-template.html benfoster/minvoice:latest

This will start Minvoice at http://localhost:5000. You can then generate your first invoice:

POST http://localhost:5000/invoices HTTP/1.1
content-type: application/json

{
  "invoice_number": "123456",
  "company_name": "Acme Ltd.",
  "company_address": {
    "line1": "Mansfield House",
    "town_city": "London",
    "zip": "WC12 4HP"
  },
  "currency": "GBP",
  "title": "Invoice from Acme",
  "recipient": {
    "name": "John Doe",
    "email": "johndoh@gmail.com"
  },
  "items": [
    {
      "title": "Website design",
      "amount": 300.00
    },
    {
      "title": "Hosting (3 months)",
      "amount": 75.00
    },
    {
      "title": "Domain name (1 year)",
      "amount": 10.00
    }
  ],
  "logo_url": "https://upload.wikimedia.org/wikipedia/commons/8/80/Logo_acme.svg"
}

This will return the generated PDF invoice in the response:

Generating an invoice

Building and running locally

Minvoice takes advantage of a number of new features in .NET 6 and C# 10. To run locally you'll need to install .NET 6.0 rc1.

To build and run the application:

dotnet run --project ./src/Minvoice/Minvoice.csproj

Built with

About

Minimal PDF invoice generator

License:MIT License


Languages

Language:HTML 44.7%Language:C# 31.2%Language:Dockerfile 24.1%