How to convert HTML to PDF accurately, with some CSS3 style support?

1

I have an HTML file with CSS3 style, which I want to "accurately" convert to PDF, that's say print all styles which I cannot do with Firefox and Opera, all output PDF lost some styles(shadows or background).

I use nth-child to show different background color like below, and that is very important to my article:

li:nth-child(2n) {
    background: #eee;
    text-shadow: 1px 1px 1px #ccc;
}
li:nth-child(2n-1) {
    background: #ddd;
    text-shadow: 1px 1px 1px #fff;
}

utopic eexpress

Posted 2016-03-30T01:29:08.143

Reputation: 43

Answers

1

Try WkHtmlToPdf. http://wkhtmltopdf.org/

wkhtmltopdf is an open source (LGPLv3) command line tool to render HTML into PDF using the Qt WebKit rendering engine.

WebDev3r

Posted 2016-03-30T01:29:08.143

Reputation: 26

I install wkhtmltopdf from repository, it works well. thanks. – utopic eexpress – 2016-03-31T07:47:00.393

0

Try this service. Creates a PDF from a website as you see it in the browser. https://lomotoh.com/ Maintains the original CSS. Seems to support CSS3. (I am affiliated with this site)

David Herse

Posted 2016-03-30T01:29:08.143

Reputation: 101