3
我绝对是新的.NET打印。我想打印一个显示在WebBrowser控件中的页面。我怎么做?打印WebBrowser控件内容
我绝对是新的.NET打印。我想打印一个显示在WebBrowser控件中的页面。我怎么做?打印WebBrowser控件内容
MSDN有关于此的文章,但他们的代码示例演示如何使用WebBrowser控件打印网页而不显示它。 :
How to: Print with a WebBrowser Control
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(@"\\myshare\help.html");
}
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();
}
如何使用web浏览器类在asp.net项目? – themis 2011-12-14 16:01:35