Problem : In Vb.Net WebBrowser Control Printer page settings

Problem : In Vb.Net WebBrowser Control Printer page settings

I am using webbrowser control in VB.Net where I am printing the payslips on the webbrowser control but the problem I faced over here is that when I try to print it the header text of the page is also printing like page file name date and extra. Also I like to increase / decrease the width and height of the page, for example I am printing the pay slips and the width of the pay slip is covering less space while their are more space available on the page itself.

I would really appreciate any sample code


 

Solution: In Vb.Net WebBrowser Control Printer page settings

Dim strKey As String = “Software\Microsoft\Internet Explorer\PageSetup”
Dim bolWritable As Boolean = True

Dim strTop As String = “margin_top”
Dim strBottom As String = “margin_bottom”
Dim strRight As String = “margin_right”
Dim strLeft As String = “margin_left”
Dim strFooter As String = “footer”
Dim FooterValue As Object = “”
Dim strHeader As String = “header”
Dim HeaderValue As Object = “”

Dim oKey As RegistryKey = Registry.CurrentUser.OpenSubKey(strKey, bolWritable)
If oKey IsNot Nothing Then
oKey.SetValue(strFooter, FooterValue)
oKey.SetValue(strHeader, HeaderValue)
‘Page Margins
oKey.SetValue(strTop, CDbl(“0.25”))
oKey.SetValue(strBottom, CDbl(“0.25”))
oKey.SetValue(strRight, CDbl(“0.25”))
oKey.SetValue(strLeft, CDbl(“0.25”))
End If
oKey.Close()

End If