AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Web thumbnailer3/9/2023 ![]() We are in a single thread and the browser does not create a separate thread for that. Since the call is asynchronous, a simple webBrowser.Navigate(URL) just won't cut it. (I initially wanted to use that for drawing the bitmap but deferred that to the point where the bitmap is actually fetched after I added the resizing part.) Now comes the interesting case. The documentCompletedEventHandler is a delegate to tell that it has loaded. WebBrowser.ScrollBarsEnabled = scrollBarsEnabled Įasy so far and pretty similar to what the regular app would do anyway. ![]() WebBrowser.Size = new Size(width, height) WebBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(documentCompletedEventHandler) Public WebPageBitmap( string url, int width, int height, bool scrollBarsEnabled) In WinForms, all you really need to do is drop a WebBrowser from your Toolbox on your form and once it's loaded the page call: I decided to pick up the more challenging part of it being the console app. But with him being the Linux guy and all. The task is pretty trivial with Windows Forms actually. NET application to make a thumbnail of a Website. Our beloved sys admin - (we all bow to him and worship his skills) has recently asked if it's possible to write a. The article describes a console-like application that loads a Web page, makes a screenshot of it and saves it as a JPG file. Thanks again for your great support! Introduction It looks like he's based a very nice service around it on his site - check it out! ![]() It is also slightly optimized with suggestions from Frank Herget. The app should no longer have problems taking snapshots of some images with JavaScript or just plain random problems. I've updated the code and the binary with the great improvements that Piers Lawson suggested in the comments.
0 Comments
Read More
Leave a Reply. |