Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set "Print background colors and images" via CSS, script, COM automate 1

Status
Not open for further replies.

awaresoft

Programmer
Feb 16, 2002
373
DE
Anyone have any ideas on how I can have an individual web page enable a browser's "Print background colors and images" option? The reason I need to enable this option is that I have an application that generates HTML based reports with tables whose background cell color is significant.

I'm open to using CSS tags (print media markup?), HTML tag attributes, script, COM automation, or browser specific proprietary markup/features to accomplish this goal.

The browsers I'm targeting are Internet Explorer 5.x or higher and FireFox 0.9 or higher on the Windows platform only.

Thanks!
Malcolm
 
AFAIK, this cannot be done. Maybe you could do something in IE, because people at Microsoft will sometimes let you poke into browser settings from a webpage but definitely not FireFox.
 
Vragabond,

I suspected as such. Still ... being able to control "Print background colors and images" via a @media type style sheet would be a great feature for future browsers.

Thank you for your reply.

Malcolm
 
I've done this with IE with code I found on this site. Something like this:
var Shell_Obj = new ActiveXObject("WScript.Shell");
Shell_Obj.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header", Client_Header_Cd);
Shell_Obj.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer", Client_Footer_Cd);
Shell_Obj.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left", Client_Margin_Left_Nbr);
Shell_Obj.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right", Client_Margin_Right_Nbr);
Shell_Obj.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top", Client_Margin_Top_Nbr);
Shell_Obj.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom", Client_Margin_Bottom_Nbr);
Shell_Obj.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Print_Background", Client_Print_BG_Ind);

Where the Client_Print_BG_Ind is 'yes' or 'no'. It was from teh HTML, XHTML & CSS Forum.
 
jlb1215,

Thanks for following up on this open question from so many months ago!!!

I will be able to use your solution for some of my client side code. Too bad your solution can't be used for regular webpages.

Regards,
Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top