I frequently use PDF engine for generating PDF of multiple web pages a kind of book. Though you can use engine specific switch to insert page number(s) but if you want beautiful CSS based numbering then below code can be used. Just paste the code in a .CSS file and link to your html pages.
/* Page number at the bottom of page */
content: "Page " counter(page) " of " counter(pages);
While looking for open source PDF generators I came across some very interesting engines available like Apache FOP and some very good PHP based engines too. My basic requirement was to run it as a batch process in Linux/Perl. The engine should supports CSS and if possible should supports PDF/A and SVG too. After doing a lot of analysis I was still not sure if all pdf issues can be solved by open source engines or not??. Then I tried my hand a bit on properitery engines like princexml and PDFReactor. They have there own advantage and disadvantages. Princexml looks really nice but there is underlying cost and also doesn’t provide interface to access the API’s for pdf manipulation. Finally I found a open source engine WKHTMLTOPDF it supports CSS and looks promising as it uses already tested rendering engine webkit .
Will share if it fits in my requirement and delivers the results.