Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print background images and colors in Edge browser

Although the browsers like IE and FF offer an option for the user to set when including backgrounds in prints, Edge doesn't seem to have this option in it's printer setup.

Is there a way one can activate this through code or native Edge JS command?

like image 243
Charlie Avatar asked Nov 08 '22 01:11

Charlie


1 Answers

This is Q&A - but I'm NOT going to accept it as the answer. So, please write yours too.

There is no apparent solution for this with Edge browser as of April 2017. Edge simply doesn't include background shades in its prints. This is lack of feature and is evident when you go to outlook.com (from Microsoft itself) to print your calendar with background colors via Edge.

One, though awkward, solution the Edge offers is the "Open with IE" menu item. This works - but works only for static pages as it tries to open the current URL right in IE.


The workaround I did for my application was to include a "Save for IE" button on my print page. When clicked, it goes through the current DOM tree of the printable page, creates a string of markup (with adjustments if necessary) and then offers the user to save it as a single file.

Now the user can open this with IE to send straight into printing.


Not good enough! But better than making your application look incapable with Edge. IF all these are not working, just create an svg element on top of where you want to print the background and give the svg element a fill color.


Edit:

Converting all my backgrounds to foreground by replacing divs with labels did the trick. It went better than I expected with transforming etc.

like image 116
Charlie Avatar answered Nov 14 '22 20:11

Charlie