Combining multiple hledger reports into a printed document on 8-1/2 x 11 inch paper

I completed my first year of bookkeeping for both business and personal expenses with hledger last year. I can honestly say that I observed zero bugs with the software. It has worked seamlessly.

I am wondering what tools exist for printing output in plain text format. For instance, I was able to generate printed documents on 8-1/2 x 11 paper by first creating a markdown file, saving relevant hledger output as code blocks within the markdown file, converting the markdown file to html using pandoc, and printing the html output from my browser. Pandoc can also convert the document to a Microsoft Word or Libreoffice format, but there was a lot of formatting that needed to take place in order to make the tables legible.

Although this approach worked, it left me wondering whether or not there is a better toolset for printing to 8-1/2 x 11 paper (or a PDF with same aspect ratio), that perhaps works with the monospaced plaintext font directly and uses font sizes and whitespace to format the document.

It seems to me that markdown is the most reasonable and widely adopted plaintext markdown format for providing a hierarchical structure to plain text documents within a text editor. The weakness that I see in markdown is tables. It can handle tables, but there are losses to efficiency when compared to combining spreadsheets with traditional word processing software.

Any thoughts on generating long form reports on paper that include hledger tables?

1 Like

One option could be Typst and it's data loading functionality:

Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use. Typst has:

  • Built-in markup for the most common formatting tasks
  • Flexible functions for everything else
  • A tightly integrated scripting system
  • Math typesetting, bibliography management, and more
  • Fast compile times thanks to incremental compilation
  • Friendly error messages in case something goes wrong
2 Likes

Thank you for recommendation! Another CLI tool that might be a good fit is groff.

This is seriously cool.

edit: I tinkered with it for few hours and I see some real potential here. Clean, easy-to-read, automated report..

2 Likes

This is our goal. Congrats and thanks for sharing that @csgagnon !

PS I'm sure we'd all love to see any example scripts and output for PTA + typst reports.

Indeed, that would be really cool,

Here is an invoice example from Awesome Typst list:

The repository has example input and output and it's really close what PTA report could be. It showcases potential nicely.

The example invoice also has an QR code, which could be used to encode metadata of PTA report into printed report:

1 Like