Printing a WebBrowser in a foreach loop
I have a collection of URLs in an arra开发者_JAVA技巧ylist. Now, I need to print the webpage in each URL using the WebBrowser
control in my Windows Forms applcaition. Can anyone please help me out on how to do this? Thank you.
1). Call IWebBrowser2.Navigate(..) to start loading a document. 2). Handle NavigateComplete() event. When the document is loaded you can print it: IHTMLDocument2.execCommand("print", null, null)
In the real world you need to handle errors, provide timeouts, as url can be wrond, server could be down etc.
Good luck!
精彩评论