How to save a webpage to a jpeg
-
Hi, I have a winForm that hosts a webcontrol. Is there any way I can save the page displayed by the control to jpg? thanx
Did you try DrawToBitmap()[^] method?
-
Did you try DrawToBitmap()[^] method?
I tried the following in the webBrowser1_Navigated handler, but the image is blank: Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height); webBrowser1.DrawToBitmap(bitmap, new Rectangle(new Point(), webBrowser1.Size)); bitmap.Save("C:\\test.jpg", ImageFormat.Jpeg); bitmap.Dispose(); any ideas? thanx
-
I tried the following in the webBrowser1_Navigated handler, but the image is blank: Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height); webBrowser1.DrawToBitmap(bitmap, new Rectangle(new Point(), webBrowser1.Size)); bitmap.Save("C:\\test.jpg", ImageFormat.Jpeg); bitmap.Dispose(); any ideas? thanx
last time I did that with a WebBrowser, the image was black, not blank!? And no, I haven't found a solution yet (I haven't been looking very hard either). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.
-
I tried the following in the webBrowser1_Navigated handler, but the image is blank: Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height); webBrowser1.DrawToBitmap(bitmap, new Rectangle(new Point(), webBrowser1.Size)); bitmap.Save("C:\\test.jpg", ImageFormat.Jpeg); bitmap.Dispose(); any ideas? thanx