txt2pdf knows what the dimensions of the pages are once it has loaded the font, page size, margins, etc. A neat/useful option would be to return this information to stdout on a new flag. E.g. output charsPerLine and linesPerPage (which _generate() already does) without processing the input text file.