Am using the window.print function on a page, but it does not print the background color which I've set in my stylesheet for table cells.
Any way to fix this issue?

Recommended Answers

Can you provide sample, relevant code?

Also, there's been recent questions similar to printing color/background. See if this is related to you...


Jump to Post

Is set in the printer dialogue by the user

Jump to Post

All 5 Replies

Ive had this happen differently in different browsers. I do belive the webkit browsers (it might be just then opposite btw) will not print the bgcolor via the dom.

Is set in the printer dialogue by the user

Somewhat similar to JorgeM's link above, I got it to print the colors after going to File -> Page Setup in Firefox's options.
However, if an end user does not know about this, is there another way to make the "css" get printed without having to go customize the settings in the browser, as different browsers will have different settings?

Websites attempting to override user settings is generally frowned upon, even if harmless it is still considered potentially malicious

it can be done in css with a @media print call, in which there is a div, full width full height containing the background image, not as background, just as an image, with a z-index=(minus something huge), visible as a background behind printed info

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.