Converting a webpage into an image
-
Hi all, I have requirement of capturing the opened webpage of my application. In my webpage i am placing a button'btn_Capture' to capture the webpage. If i click on button the whole web page should be converted into image(Except the btn_Capture). Please suggest me how to achieve this. Thanks inadvance,
-
Hi all, I have requirement of capturing the opened webpage of my application. In my webpage i am placing a button'btn_Capture' to capture the webpage. If i click on button the whole web page should be converted into image(Except the btn_Capture). Please suggest me how to achieve this. Thanks inadvance,
Try one of the following sites. http://www.guangmingsoft.net/htmlsnapshot/help.htm[^] http://www.codegod.de/WebAppCodeGod/screenshot-of-webpage-with-aspnet-AID398.aspx[^]
-
Try one of the following sites. http://www.guangmingsoft.net/htmlsnapshot/help.htm[^] http://www.codegod.de/WebAppCodeGod/screenshot-of-webpage-with-aspnet-AID398.aspx[^]
Thanks metillica_rock10. I will try those links.
-
Hi all, I have requirement of capturing the opened webpage of my application. In my webpage i am placing a button'btn_Capture' to capture the webpage. If i click on button the whole web page should be converted into image(Except the btn_Capture). Please suggest me how to achieve this. Thanks inadvance,
I got the logic. Here is logic i am pasting for others. Code In VB.Net ============== Imports Microsoft.VisualBasic Imports System.Threading Imports System.Drawing Imports System.Windows.Forms Private Class HtmlToImage Private PageUrl As String Private ConvertedImage As Bitmap Private m_intHeight As Integer Public Property Height() As Integer Get Return m_intHeight End Get Set(ByVal value As Integer) m_intHeight = value End Set End Property Private m_intWidth As Integer Public Property Width() As Integer Get Return m_intWidth End Get Set(ByVal value As Integer) m_intWidth = value End Set End Property Public Function ConvertPage(ByVal PageUrl As String) As Bitmap Me.PageUrl = PageUrl Dim thrCurrent As New Thread(New ThreadStart(AddressOf CreateImage)) thrCurrent.SetApartmentState(ApartmentState.STA) thrCurrent.Start() thrCurrent.Join() Return ConvertedImage End Function Private Sub CreateImage() Dim BrowsePage As New WebBrowser() BrowsePage.ScrollBarsEnabled = False BrowsePage.Navigate(PageUrl) AddHandler BrowsePage.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted While BrowsePage.ReadyState <> WebBrowserReadyState.Complete Application.DoEvents() End While BrowsePage.Dispose() End Sub Private Sub WebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) Dim BrowsePage As WebBrowser = DirectCast(sender, WebBrowser) BrowsePage.ClientSize = New Size(Width, Height) BrowsePage.ScrollBarsEnabled = False ConvertedImage = New Bitmap(Width, Height) BrowsePage.BringToFront() BrowsePage.DrawToBitmap(ConvertedImage, BrowsePage.Bounds) End Sub End Class ///////////////////////////// In C#.Net ========= using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; using System.Drawing; namespace HtmlToImage { class ImageFromHtml { private string PageUrl; private Bitmap ConvertedImage; private int m_intHeight; public int Height { get { return m_intHeight; } set { m_intHeight = value; }