Reputation: 145
How to print a specified file in WPF using PrintDialog.PrintDocument() method?
I want to Print the html page using print Dialog.
Upvotes: 0
Views: 1893
Reputation: 145
Refer MIcrosft.mshtml com object
mshtml.IHTMLDocument2 doc = rptPreview.Document as mshtml.IHTMLDocument2; doc.execCommand("Print", true, null);
Upvotes: 0
Reputation: 38094
It is possible by using the Print() method of the WebBrowser Class in C# to do this. Just put the content to the WebBrowser Control like so:
webBrowser1.DocumentContent = openfiledialog.FileName;
Then just call the "webBrowser1.Print();" method.
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.print.aspx
Upvotes: 1
Reputation: 6175
You'll need some kind of an html renderer in order to print it. either IEExplorer (look into shdocvw.dll and mshtml.dll) or Awesomium etc... good luck.
Upvotes: 1