I am looking for a way to print a formatted html file in landscape mode in c# (primarily wpf). Print dialog would be nice in order to set the page setting to landscape. I tried using Microsoft's html to xaml converter and it destroyed the formatting. I find it quite amazing that there is no method or grabbing a file and sending directly to a printer.
Any ideas would be much appreciated.
WebBrowser myWebBrowser = new WebBrowser();
private void Form1_Load(object sender, EventArgs e)
{
myWebBrowser.DocumentCompleted += myWebBrowser_DocumentCompleted;
myWebBrowser.DocumentText =System .IO.File .ReadAllText ( @"C:\a.htm");
}
private void myWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
myWebBrowser.Print();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With