Simple utility for PDF invoice generation in Python
- Install the module
pip install pdf-invoice-util
- Copy
config/config.example.yaml
from the repository toconfig/config.yaml
and update parameter values as desired - Optionally configure terms by creating a
translations/terms.[language].yaml
file, check out the example fileconfig/terms.example.yaml
- Import the module
from pdf_invoice_util import Invoice, InvoicePDF
- Generate an invoice object eg.
invoice = Invoice(invoice_id, invoice_date <YY-mm-dd>, customer_id, customer_name, customer_address, customer_postal_code, customer_city, customer_country, customer_vat_registered_number, vat_percentage)
- Set article lines by using the
set_articles()
method on the invoice object, eg.invoice.set_articles([{'name': 'Pizza margherita', 'price': 9.99, 'amount': 1}, {'name': 'Pizza fungi', 'price': 11.99, 'amount': 1}])
- Generate an InvoicePDF object eg.
pdf = InvoicePDF(invoice <the invoice object>, invoice_language <the desired print language>)
- Generate the PDF by running the
generate_document()
method on the InvoicePDF object
Translations can be overwritten by copying the translation file into /translations folder
Feel free or make proposals for code contributions and the addition of translation files for additional language support in this repository
Big thanks to Pluralsight (https://www.pluralsight.com) and Chart Explorers (https://www.youtube.com/@ChartExplorers) for the detailed descriptions on working with the used techniques