My software creates an HTML document with CSS, just to convert it to PDF afterwards (JS: window.print()). The generated PDF ignores CSS background colors, probably to save ink - but I don't want that. I want to have my document printed exactly the way it looks naturally. I know I could modify the print by using a @media print
, but as I have lots of inline CSS in my code now, that would be horrible to implement. Is there an elegenat way to put some kind of flag in my document, so that the window.print() doesn't modify anything?
Maybe some kind of @media print
of pure ignorance?
The duplicate solved it, just put this in the head-style and it works:
@media print {
* {
-webkit-print-color-adjust: exact;
}
}