I use PrinceXML at work, for generating press-ready output. (E.g. a catalog, generated straight from the product database and ready to be sent to the printer. Previously they were doing this all manually with PageMaker, which was very tedious and prone to mistakes.) It supports the CSS Paged Media spec, so you have full control over page layout: margins, widows and orphans, page breaks, bleeds, and so on. It also understands page numbers, and gives you full control over headers and footers. Other things it supports include press crop marks, color management, and PDF options like bookmarks and PDF link regions.
Headless browser rendering is fine if all you need is a two-page invoice PDF, but it falls down when you need control of anything other than basic stuff like the font size.