I'm trying to set Paper Size A5,PageOrientation,Set name Printer in a web browser control with code in VB.NET
I tried no webbrowser effect, is there anything I am wrong with the code I please guide me.
I tried according to this link : text
Thanks
Private Sub pagesetupkey()
Dim pageSetupKey As String = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Dim isWritable As Boolean = True
Dim rKey As RegistryKey = Registry.CurrentUser.OpenSubKey(pageSetupKey, isWritable)
' Use 1 for Portrait and 2 for Landccape
rKey.SetValue("PageOrientation", 2, RegistryValueKind.DWord)
' Specifies paper size. Valid settings are 1=letter, 5=Legal, 9=A4, 13=B5.Default setting is 1.
rKey.SetValue("PaperSize", 9, RegistryValueKind.DWord)
' Specifies print quality
rKey.SetValue("PrintQuality ", 1, RegistryValueKind.DWord)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Using dt = LoadData("A")
Call pagesetupkey()
myWebBrowser.DocumentText = DataTableToHtml(dt)
End Using
End Sub
Private Sub myWebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) Handles myWebBrowser.DocumentCompleted
Call pagesetupkey()
myWebBrowser.ShowPrintPreviewDialog()
'myWebBrowser.Print()
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
myWebBrowser.Parent = Me
End Sub
