Printing the contents of a WPF WebBrowser

后端 未结 3 1699
北恋
北恋 2020-12-17 07:19

I\'m trying to print the contents of a WPF WebBrowser control so that no print dialog is shown, but am having no luck.

I have tried the following and am sure it did

3条回答
  •  一生所求
    2020-12-17 08:09

    // Send the Print command to WebBrowser. For this code to work: add the Microsoft.mshtml .NET reference
    mshtml.IHTMLDocument2 doc = WebBrowser1.Document as mshtml.IHTMLDocument2;
    doc.execCommand("Print", true, null);
    

    Source: http://social.msdn.microsoft.com/Forums/en/wpf/thread/63ae5345-b2ca-45a9-9113-0ddc43e9925b

提交回复
热议问题