# Dusk Invoice *Generate PDF invoices using [Cairo][cairo].* This project is a [Dusk package][usermode] that wraps Cairo to generate PDF invoices from a simple text file following a specific format. The package isn't designed to be very configurable, but rather to have a source code simple enough that it can easily be adapted to your needs. This code is available from [Dusk OS' files folder][files] or as a Git repository ([without SSL][ssl]) at: git://git.duskos.org/dusk-invoice.git ## Input format The first 10 lines (separated by ASCII LF) of the input files have a fixed meaning. Line 1 is the language selector. It can be `en` or `fr` and it selects the language of the fixed strings being printed in the output. Line 2 is the date of the invoice. It's a free-form string. Lines 3-6 are the "Bill From" lines. Lines 7-10 are the "Bill To" lines. The rest of the lines are the "item lines" and each line begins with a quantity, then unit price, then description. Quantity and unit price fields are in "integer cents" format. For example, `142` means "1.42". Here's an example input file: en Jan 7 2024 Virgil Dupras 42 Forth Ave Montreal, QC A1B 2C3 Canada Jules Winnfield 123 Sunset Blvd Inglewood, Las Vegas CA USA 2000 10000 Introduction to programming (hours) 400000 30 Transportation (km) ## Build and run To build this project, you need: * [curl][curl] * A C compiler * Make (BSD or GNU) Running `make` will download [Dusk OS][dusk] and compile the package using its [Usermode][usermode]. The end result in a standalone `dkinvoice` executable. This executable reads input from standard input and spits its ouput to a file specified as argument. It can therefore be executed like this: ./dkinvoice result.pdf < myinput.txt [dusk]: http://duskos.org [usermode]: http://duskos.org/usermode.html [cairo]: https://www.cairographics.org [curl]: https://curl.se/ [ssl]: http://duskos.org/ssl.html [files]: http://duskos.org/files/