I have html contains a table. I am converting the html to pdf using pdfhtml itext7. the issue is when adding color to the table then the color is not rendering in the pdf. what to add to the CSS file in order to make it working what is the value that should be added to background-color ?? tried many things to make it working.
table{
background-color: xxxx ;
width: auto;
height: auto;
}
1 Answer 1
Try this in your CSS:
body {
-webkit-print-color-adjust: exact !important;
color-adjust: exact !important;
print-color-adjust: exact !important;
}
By default, most browsers don't print background images and background colors.
answered Aug 24, 2022 at 20:41
Richard Henage
1,7981 gold badge5 silver badges11 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
eded
thank you but this didn't solve the issue . the color of the table on the html page could be different every-time depend on the user needs but i don't know how ro tell the pdf to render it .
lang-html