Good base module.
I used PDF:TextBlock to handle paragraphs.
For memory performance, I produce one page at a time with API2 and Textblock, then join them at the end with PDF Reuse (reduced max RAM to about 23.5 MB, reduced final file size by a third). I also print my footer with PDF Reuse, because it is includes # of pages (page x/y). API2 methods 'new (-file)' and 'finishobjects' don't actually help with RAM, so mine was running out of control (362 MB on 106 page doc).