When I use
$ weasyprint table.html table.pdf
on https://jsfiddle.net/MartinThoma/0hL29mcc/ it generates a PDF which looks like this:
As you can see, the heading is black, not red. Also, the table is not striped anymore.
Somehow weasyprint removes all colors. How can I prevent this behaviour / keep the colors? (I don't necessarily need to use weasyprint, but I don't know any better alternative)
I use WeasyPrint version 0.40
.
pandoc table.html -o table.pdf
: Does not apply CSS page rotation; does not apply CSSwkhtmltopdf table.html out.pdf
: Does not apply CSS page rotation; (but applies some CSS - not the color, though)import pdfkit;pdfkit.from_file('table.html', 'outpdfkit.pdf')
: Does not apply CSS page rotation (looks the same as wkhtmltopdf
)The main problem is that Bootstrap 3 contains the following:
@media print{
*,:after,:before {
color:#000!important;
text-shadow:none!important;
background:0 0!important;
-webkit-box-shadow:none!important;
box-shadow:none!important
}
}
So weasyprint is actually behaving as intended. Removing this leads to the expected results.