Force browser to print background graphics using CSS in ASP.Net

on Jul 26, 2021 11:13 PM


Does anyone know how to override browser background graphics settings when printing in ASP.Net/CSS.

If the browser background graphics is not enabled/ticked on user's web browser(i.e on Chrome) when a user prints the web page, I would like to override this setting and enable/tick browser background graphics.


Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Jul 28, 2021 06:18 AM

Hi madawak,

The -webkit-print-color-adjust property is a non-standard CSS extension that can be used to force printing of background colors and images in browsers based on the WebKit engine.

This forces browsers to use background colors when user prints a web page even if they have Print Options Background Graphics turned off.

economy (Default value)

Normal behavior. Background colors and images are only printed if the user explicitly allows it in their browser's print settings dialog.


Background colors and images of the element to which this rule is applied are always printed, user's print settings are overridden.


-webkit-print-color-adjust: exact;


    <meta charset="utf-8" />
        #dvHtml {
            background-color: #123456 !important;

        @media print {
            body {
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                -ms-print-color-adjust: exact;
                print-color-adjust: exact;
    <div style="height:100%" id="dvHtml">
        <br /><br /><br /><br /><br />