Comment by fogzen
Don’t. Show a web page and open the print dialog, and tell people to save as PDF. All major browsers support this, and the browser HTML to PDF code is the most robust and accurate.
Don’t. Show a web page and open the print dialog, and tell people to save as PDF. All major browsers support this, and the browser HTML to PDF code is the most robust and accurate.
There's nothing in OP's question that suggests this is a one-off operation in response to a user action.
It's very likely to be a massive batch operation of a ton of HTML files that might not even be their own site.