News for hackers. Stuff that matters.
Re:PEP – An open source PDF editor for Mac by tkfu on Tuesday September 15, 2020 @09:29AM (#24480956)
Are you familiar with Prawn [1]? Perhaps I just haven't bumped up against its limitations yet, but in my experience it's exactly what you're asking for. Of course, it's in Ruby, which isn't to everyone's taste, but it's the best tool out there that I've found.

[1] https://github.com/prawnpdf/prawn

Re:PEP – An open source PDF editor for Mac by strogonoff on Tuesday September 15, 2020 @09:37AM (#24481019)
Prawn was considered and IIRC unfortunately it has very limited styling support.

It looks like there are only commercial and quite expensive options for programmatic generation (Antenna House: XSL-FO, Prince: CSS). Apart from that, the one option that works appears to be Apache FOP. It’s built on Java and uses XSL-FO, which is somewhat limited and seemingly on the way to becoming outdated.

Re:PEP – An open source PDF editor for Mac by phonon on Tuesday September 15, 2020 @01:27PM (#24483995)
https://weasyprint.org/ is quite nice, though has limited header/footer support (for now).
Re:PEP – An open source PDF editor for Mac by Lammy on Tuesday September 15, 2020 @03:38PM (#24485783)
Check out HexaPDF too, also in Ruby: https://github.com/gettalong/hexapdf