Hariprabu
Hariprabu

Reputation: 71

Display Background color in print page

I am using javascript:print() for taking print in PHP script.I added the background color in that.Actually it will be dynamic background color.While seeing the print preview the background color is not coming.Kindly anyone help in this issue.

Thanks in advance.

Upvotes: 0

Views: 1187

Answers (2)

jeroen
jeroen

Reputation: 91734

Although @Jan.'s answer is correct and you should not mess with the users preferences and settings, it is technically possible.

Just position an element behind all of your content and put an image in it having your desired background color that stretches to 100% width and 100% height. Using javascript / css this would be pretty easy.

It will annoy (to put it mildly...) people who print the page though...

Upvotes: 0

Jan.
Jan.

Reputation: 1995

You can not control this via javascript.

The user may enable printing of background images or color in the printer dialog.

Upvotes: 2

Related Questions