I am using the wkhtmltopdf
on my amazon ubuntu instance to generate an invoice's PDF. The page is PHP. Everything is working fine except the background color of the html div tags. The border color is working fine. Is there any setting in wkhtmltopdf
to enable printing background color of the div tag?
I have tried bgcolor, css and inline style, also I have checked converting the page in Table structure but none of these helped.
I had this issue as well, and the css was right in the same HTML file. The trick for me ended up being the somewhat-mysterious "!important" at the end of the background-color tag like so:
background-color: #f2f4f7 !important;
Use This especially when you generate PDF from google App Script
@media print
{
.class
{
background-color: #1a4567 !important;
-webkit-print-color-adjust: exact;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With