Sam
Sam

Reputation: 15506

Supplementary properties/settings for JavaScript:window.print() to enable Backgrounds by default

I would like tot give my Print this Page button a special magical property sothat it automatically enabled the by default unset property (see picture) namely to Do Print the Backgrounds of div colors and bg images etc.

<a href="#" onclick="javascript:window.print()"><? echo __('Print'); ?></a>

Clues, ideas, code, answers or suggestions as answers are all tremmendously welcome and I a will appreciate any hints at all for this dream to come true. Thanks in advance.

enter image description here

Upvotes: 3

Views: 5087

Answers (3)

Abdul Rehman Zaheer
Abdul Rehman Zaheer

Reputation: 11

You can use something like below

<style>
@media print {
    *{ 
        -webkit-print-color-adjust: exact !important; //for chrome
        Safari color-adjust: exact !important; // For Firefox 
     }
}
</style>

Upvotes: 0

mattsven
mattsven

Reputation: 23283

This cannot be done, unfortunately. This is disabled across all browsers by default (unless a user changes it in their settings).

Upvotes: 4

Arif
Arif

Reputation: 21

This is not possible . You cannot change the browser settings , if that would be possible people could hack in very easily

Upvotes: 2

Related Questions