0

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; 
}
asked Aug 24, 2022 at 20:36
0

1 Answer 1

0

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
Sign up to request clarification or add additional context in comments.

1 Comment

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 .

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.