Getting started
The gc2latex suite consists of three components:
- A hierarchy of Perl classes to access the Gnucash account file
- The gc2latex.pl script itself
- A LaTeX template file which the extracted values are placed into
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:
- The number of the invoice
- The date the invoice was closed and posted
- The customers address
- The prices, tax informations and dates of your invoice items
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 gc2latex.pl script with three parameters:
- the LaTeX template file
- the Gnucash account file
- 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.
Gnucash invoices with LaTeX and Perl