After trying many HTML2PDF libraries we're doing the same thing and are quite happy with this approach. I've tried using "professional" solutions like iText pdfHTML[0]. They all seem to be based on flyingsaucer[1] which only supports HTML4 and CSS2, and will fail rendering pages that use modern CSS let alone JavaScript.