Click here to Skip to main content
16,004,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I'm new in c# and I need to do a printing application, can I change the default printer setting so that I can select different printer tray to print out the HTML file.

Here is the HTML file printing code that i found:
C#
private void PrintHelpPage()
{
      // Create a WebBrowser instance. 
      WebBrowser webBrowserForPrinting = new WebBrowser();

      // Add an event handler that prints the document after it loads.
      webBrowserForPrinting.DocumentCompleted +=
                new WebBrowserDocumentCompletedEventHandler(PrintDocument);

      // Set the Url property to load the document.
      webBrowserForPrinting.Url = new Uri(@"C:/Users/Administrator/Desktop/dffasadadsadadsa.html");

     // Set print preview size same as the size of winForm
     webBrowserForPrinting.Parent = this;
}        



private void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e)
{            
     // Print the document now that it is fully loaded.            
     ((WebBrowser)sender).Print();            

     // Dispose the WebBrowser now that the task is complete. 
     ((WebBrowser)sender).Dispose();
}


Can I change to printer setting in the code above? Thanks
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900