Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Converting a webpage into an image

Converting a webpage into an image

Scheduled Pinned Locked Moved ASP.NET
tutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K V Sekhar
    wrote on last edited by
    #1

    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,

    M K 2 Replies Last reply
    0
    • K K V Sekhar

      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,

      M Offline
      M Offline
      metallica_rock10
      wrote on last edited by
      #2

      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[^]

      ASP.NET

      K 1 Reply Last reply
      0
      • M metallica_rock10

        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[^]

        ASP.NET

        K Offline
        K Offline
        K V Sekhar
        wrote on last edited by
        #3

        Thanks metillica_rock10. I will try those links.

        1 Reply Last reply
        0
        • K K V Sekhar

          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,

          K Offline
          K Offline
          K V Sekhar
          wrote on last edited by
          #4

          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; }

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups