Render Webpage as Bitmap in GDI+

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.
 
Screenshot maybe ?

naeem_s said:
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 its done here.)

Good day ! :D
 
I dont know what steps you would take to do all of this in .NET, but I know that PDFs 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.
 
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 isnt show on context menu, but you still use it :D .

Everything will be OK.
 

Similar threads

A
Replies
0
Views
52
Angeldas
A
T
Replies
0
Views
567
This_display_name_is_already_in_use_They_all_are
T
Back
Top