Countless solutions exist that attempt to turn html/css into generated pdfs. I’ve spent countless hours trying to make the generated documents look just right. Occasionally the output from these tools have even been different from machine to machine.
I’ve taken an alternative approach. Instead of using html/css I use the Tex document production system. click here for more information about tex
Sprinkle in some mustache templating, and you have yourself a system who can automate the generation of any type of pdf on the fly: newsletters, invoices, bills, complex contracts…. watermarked ebooks - the possibilities are endless.
Check out the website https://www.docgen.io/
Api documentation https://www.docgen.io/