1

Possible Duplicate:
Print background image in IE without enable “Print background colors and images”
How to get a background image to print using css?

I want to print all background images that come from CSS using background.

I haven't put any hidden div to the HTML so could someone please suggest another solution.

Community
  • 1
  • 1
Kushal Jayswal
  • 925
  • 1
  • 12
  • 31
  • 1
    Please post your CSS code of the relative div. – Ladineko Dec 13 '12 at 08:51
  • well, per default browsers prevent printing of background-images. You needed to put those urls into img tags to be able to print them. (Or prompt the user to adapt their settings...) – Christoph Dec 13 '12 at 08:53

2 Answers2

4

There is not a way of forcing background images to appear on print.

By default the majority of browsers omit backgrounds when printing.

It is up to the user to specify whether they want to include the background, not the website.


Google Chrome

Currently I don't think its possible at all for the user to be able to print backgrounds.

See this Google thread for more information on users requesting this feature:

http://productforums.google.com/forum/#!topic/chrome/OFAAdLqAuT4%5B1-25%5D

Curtis
  • 101,612
  • 66
  • 270
  • 352
  • To be fair (until we find out otherwise), the OP didn't actually stipulate forcing the end-user of anything to print background images. So could just asking "how do I...". Maybe. – Jared Farrish Dec 13 '12 at 08:58
  • Oh thanks for very quick answer but kind of trick I know but we can't force client to force to enable background images from browser setting. – Kushal Jayswal Dec 13 '12 at 09:04
0

First of all, the answer before mine is absolutely correct. There is no way to force background printing from CSS/HTML/Javascript in any browser. The setting has to be done by the user (or your companies global windows domain policy settings or linux equivalent).

I will however provide you with a link that contains the proper setting for every browser that allows you to turn on background printing: http://support.lexercise.com/entries/382786-enable-background-image-printing-in-your-browser

Damien Overeem
  • 4,487
  • 4
  • 36
  • 55
  • I know there's no solution but yet I am trying to find again and again. If there is anything we can do with jQuery it would be good. What say? – Kushal Jayswal Dec 13 '12 at 09:07
  • No option at all. The printing settings are system/OS settings to which javascript has no access, making it impossible to force the setting. This + the fact that you cant 100% force page breaks, landscape printing etc, is the reason people use PDF most of the time for print. – Damien Overeem Dec 13 '12 at 09:08
  • right! But all UIs has to face the same situation sometime. May be some of them have been scold by client. Isn't it? Well not me I can explain to client well! But we should get solution for this ASAP. Please post if anyone can have. – Kushal Jayswal Dec 13 '12 at 09:21
  • Well there actually has been -some- progress concerning printing. Atleast we can now use css like `page-break-before: always;` to tell the printing process to break at that point and `size: landscape` for landscape printing, but both are fairly badly supported by browsers. Its a very slow process and so far there are no hints for any css property to force background printing (which would cost the user more ink = money = their choice) – Damien Overeem Dec 13 '12 at 09:33
  • "page-break-before: always;" is different though I just want to get answer for Background Images sir :). – Kushal Jayswal Dec 13 '12 at 09:41
  • I never said it was the same. Was just explaining that atleast some print features can be manipulated with CSS, but background images isn't one of them. – Damien Overeem Dec 13 '12 at 10:53