Hello!
I'm using this component and I realized that the background colors of the DIVs are not being displayed in the final PDF.
Have you experienced this behavior before? Do you know how to overcome it?
Thanks
Hi Hernâni,
The PDF functionality is coming from the HTML2PDF component which in this case is based on the wkhtml2pdf executable.
There is indeed a bug in this utility, which is mentioned also here: https://stackoverflow.com/questions/25118343/wkhtmltopdf-div-background-color
By adding a !important behind the CSS lines that give the color in your app, you should be able to overcome this issue.
Let us know if this work-around solves your issue.
Kind regards,
Remco Dekkinga
Hello, Remco.
Thanks for your reply.
I wasn't able to solve the issue. Do you think you can show me an example in a oml?
Dekkinga wrote
Try to use media print query may be it will solve your problem
Like below.
@media print { .class { background-color: #1a4567 !important; -webkit-print-color-adjust: exact; } }
@media print
{ .class
{
background-color: #1a4567 !important;
-webkit-print-color-adjust: exact; }
}
But make sure you have to write This piece of code to get background color.
-webkit-print-color-adjust: exact;
Regards,
Pankaj
Hernâni Fernandes, did the last fix from Pankaj work?
I have a variation of this issue in that the pdf screen comes up the colors, when I print the pdf screen to a pdf file it keeps the colors, but when I download the pdf screen to a pdf it loses the colors from the table records header background and the odd and even lines background.
Has anyone made this work completely?