To my Homepage
Did this site help you?
Average rating (GnuCash):
2.90/3 (365 votes)

Gnucash invoices with LaTeX and Perl

...not that ugly anymore

Although Gnucash is fine at managing my expenses, I was never satisfied by the printed invoices. That's why I developed a suite of perl scripts to use LaTeX as a way of generating nicer printouts.

Getting started

The gc2latex suite consists of three components:

The classes encapsulate the access to the gnucash XML file, and are used by the script to retrieve alle data related to the invoice. These include:

To set your own address, bank account informations, a company graphic and similar customizations, just edit the template file. Inside the template file, certain keywords will be replaced by the corresponding data:

__GNUCASH-INVOICE-ID__The unique ID of the invoice
__GNUCASH-POSTING-DATE__The date the invoice was booked
__GNUCASH-CUSTOMER__The address of the customer
__GNUCASH-TABLE__The table with each item and the summary

Creating an invoice

To create an invoice, simply call the script with three parameters:

  1. the LaTeX template file
  2. the Gnucash account file
  3. the id of the invoice you wish to print

If everything goes right, the script will print the LaTeX document on its standard output. If it does not, you might have done something wrong, feel free to contact me :-)

To convert it to something printable, simply run latex on the file - It will generate a dvi file, which can be viewed with xdvi or converted to Postscript by dvips. You can also create a PDF file by using dvipdf, like I have done in this examples file.