naeem_s Posted March 23, 2004 Posted March 23, 2004 Is it possible to render a webpage as a bitmap in GDI+? Quote
Arch4ngel Posted March 23, 2004 Posted March 23, 2004 Sorry... I don't see the utility of this.... Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
naeem_s Posted March 24, 2004 Author Posted March 24, 2004 I want to be able to wrap this functionality into a web service. You could then use it as part of a web search where alongside each search result you could show a thumbnail image of the web page. Quote
Arch4ngel Posted March 24, 2004 Posted March 24, 2004 Screenshot maybe ? I want to be able to wrap this functionality into a web service. You could then use it as part of a web search where alongside each search result you could show a thumbnail image of the web page. So... you could take a screen shot of your browser in maximize mode dynamicly and transfer it to a Bitmap object and resize it to the right size and save it as a file. (For the screen shot... you can see it how it's done here.) Good day ! :D Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
naeem_s Posted March 25, 2004 Author Posted March 25, 2004 Thanks for the screen shot example, i did come across it before. any more ideas? Quote
mjb3030 Posted March 26, 2004 Posted March 26, 2004 I don't know what steps you would take to do all of this in .NET, but I know that PDF's can be converted to BMP. So, if you printed the web page to a PDF file and then converted it to BMP..... Or, maybe there is a way (perhaps someone has already created a component for this) to print directly to a BMP file. That way you could get the whole page instead of just the portion on the screen. Quote
mjb3030 Posted March 26, 2004 Posted March 26, 2004 Check this out: http://www.leadtools.com/Utilities/PrinterDriver/Converter/ePrint_As_A_BMP_Converter.htm Quote
mjb3030 Posted March 26, 2004 Posted March 26, 2004 Or this: http://www.zan1011.com/ Sorry for the multiple posts... I keep finding more stuff after I've already posted. Quote
BlackFatPig Posted August 9, 2008 Posted August 9, 2008 Dear naeem_s ! I hope my code can help you :o : Private Sub Capture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Capture.Click Dim w As New WebBrowser() w.Size = New Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height) w.Navigate("http://www.google.com.vn") AddHandler w.DocumentCompleted, AddressOf CompletedDoc End Sub Private Sub CompletedDoc(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) Dim w As WebBrowser = CType(sender, WebBrowser) Dim b As New Bitmap(w.Document.Body.ScrollRectangle.Width, w.Document.Body.ScrollRectangle.Height) w.DrawToBitmap(b, New Rectangle(0, 0, b.Width, b.Height)) b.Save("Your Image File Path Here", Drawing.Imaging.ImageFormat.Jpeg) b.Dispose() w.Dispose() End Sub Note: the DrawToBitmap method isn't show on context menu, but you still use it :D . Everything will be OK. Quote
Guest Farhomar Posted July 21, 2010 Posted July 21, 2010 I use WebsitesScreenshot .NET library in all my projects which require html to image conversion or web page screenshot. http://www.websitesscreenshot.com/ WebsitesScreenshot.WebsitesScreenshot _Obj; _Obj = new WebsitesScreenshot.WebsitesScreenshot(); WebsitesScreenshot.WebsitesScreenshot.Result _Result; _Result = _Obj.CaptureWebpage("http://www.msn.com"); if (_Result == WebsitesScreenshot. WebsitesScreenshot.Result.Captured) { _Obj.ImageWidth = 200; _Obj.ImageHeight = 300; _Obj.ImageFormat = WebsitesScreenshot. WebsitesScreenshot.ImageFormats.PNG; _Obj.SaveImage("c:\\msn.png"); } _Obj.Dispose(); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.