Have been working with the open-source ReportLab package to create invoices the last few days. The results aren't what I would consider beautiful yet, but they are a reasonable layout format for an invoice. Since it took me a bit of time to set it up I figure I'll share it with the world.
The code assumes that you have an "invoice" object with multiple streams, those streams providing iteration methods that allow you to find the individual line-items within the stream, as well as the discounts applied post-tax to the stream. A total of all charges is presented on the first page of the invoice.
You can see code in there to produce alternate-line colours (that is, alternating line-items are shown in different background colours). There's also code for doing column-spanning, and column alignment. There are two headers, a larger first-page header and a smaller second-page header, those aren't handled particularly well at the moment, they should be auto-expanding so that if the client address is short the main frame is further up the page.
The entire thing needs some refactoring, but oh well, it should give an idea of how ReportLab works. Enjoy.