Prince renders HTML somewhat different than browsers and doesn't support the latest HTML + CSS standards, why choose it for new stuff over headless chrome and/or puppeteer?
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.
This is definitely not the case anymore, and BreezyPDFLite supports most of the features you mention, while supporting the same HTML/CSS/JS you might be displaying to end users across evergreen browsers.
h2 {flow: static(header);}
@page :right {
margin-bottom: 1.4cm;
@top-left {content: flow(header);}
@bottom-right {content: counter(page);}
}
Edit: Also, tables of contents, with page numbers and links in the PDF: ul.toc a::after {content: leader('.') target-counter(attr(href), page);}Building TOC is just as easy as building the HTML and linking to the ID's appropriately.
Page numbers are supported in header/footer templates, or via manual computation when you render the HTML or with JS.