Hmm, ledger[0] or hledger[1] is probably the best solution then. You
could instead write a script to generate invoices from the data in them.
The invoice data from my hledger file and a HTML template together are generated to a HTML invoice. The HTML invoice together with a CSS file are processed to PDF using WeasyPrint [1].