WEB_BROWSER printing

apokas

New member
Joined
Jan 14, 2008
Messages
2
Programming Experience
3-5
Hi, i have an issue. I have developed a windows e-commerce application wich basicly is used for invoices, commercial offers and other documents generation and printing. I have writen my HTML generator class everything is superb. For HTML documents viewing and printing i use built in VS webbrowser control. So everything is fine except that i can't figure out how to programmaticaly set WEBBROWSER control to print backgruond colors and images. Or maybe some of you guys can provide information how to customize this control and add such feature. Allso i am interested i HEADER and FOOTER customization. Need assistance urgent!

Thanks in advance,
With respect Aurimas
 
This is a global IE browser setting, user can choose to enable this in Internet Options. In "Printing" section of "Advanced" tab user may check "Print background colors and images". Default is 'off' because this is most printer-friendly.
The setting is stored in registry, so you can ask user to change this from your app and modify it directly. It's a string pair "Print_Background" with value "yes/no" in:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
Operating registry in code is very easy, example:
VB.NET:
Dim path As String = "Software\Microsoft\Internet Explorer\Main"
Dim key As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey(path, True)
key.SetValue("Print_Background", "yes")
key.Close()
 
And what about security If there is registry guard for example like KASPERSKY IS has will there be any issues? and how i can make my program look unharmfull and friendly to os?
 
The user need registry write permission by OS/User configuration to write to registry, else you get a SecurityException. There are different levels of security for different locations of registry. The above modifies the private user part of registry. Would think this was ok, since this is a user setting and user can use the configuration dialog to change same value. I don't know Kapersky, does it detect attempted access and ask user to allow/deny?
 
Back
Top