Tag Archives: html to image

Capture image in an existing webbrowser control

Htmlsnapshot can capture image of an existing webbrowser control and save it into jpg, bmp, gif, png etc.

You need to pass the object instance of the webbrowser control (IDispatch in C++).

In VB6, you can do it like below:

     Dim snap1 As HtmlSnap2.CHtmlSnap
     Set snap1 = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
     snap1.SnapWebBrowser WebBrowser1.Object, “c:web.bmp”
     snap1.Clear

We also provide C# demo with our trial version.

Convert html to image with Html Snapshot Component

Do you ever want to take a screen shot of a web page in your desktop or web application? HTML Snapshot ActiveX is a software component that can make html to image easier than ever before. It can download and parse web sites and save a screenshot of the page in GIF, JPG, JPEG, BMP, PNG, TIFF, WMF and EMF. You can choose to capture the entire page, or a thumbnail image of a specified size, and save it to a local folder.

The key benifits of using Html Snapshot are:

  • It is a flexiable componet to convert html (embeded flash movie support), mht, VML, SVG and text to image on the fly to file or in memory.
  • Convert html to image into various image formats like JPEG and TIFF etc. with custom saving options.
  • Html snapshot can be used in many programming or script languages to convert html to image, what’s more, it is easy to start using html snapshot with rich samples.
  • Html Snapshot has been used by thousands of enterprise customers since its first release in 2004. And it is being constantly improved by the company Guangming Software. Lot of new features and fixes are adding to the product.

    Here below lists the high light features of the component.

  • Directly save the web page at a given URL into image in bmp, jpeg, tiff, gif or png format. (i.e. html to image, html to jpg, html to image, html to tiff, html to png etc)
  • Directly convert html string to images.
  • Directly convert MHT web archive to image in bmp, jpeg, tiff, gif or png format
  • Support saving the whole html page to image without scrollbars.
  • Support http authentication and bypass authentication dialog automatically
  • Create thumbnail images from large images.
  • Get links, title, cookie or html source of a page
  • Get the html document DOM interface
  • Make gray or black and white images
  • Reduce color number in images while keeping better quality.
  • Support compressing images into jpg, tiff, gif or png in memory without temporary files created.
  • Support JPEG compression level and TIFF compression method selection
  • Convert vector graphics WMF, EMF, SVG and VML to bmp, jpg, jpeg, tiff, gif or png
  • Convert html to vector image format like EMF and WMF
  • Convert html to transparent GIF
  • Convert html to image with an existing webbrowser control
  • Automatically clip the image by removing white area in the html generated image
  • Examples in VC, Delphi, VB, VB.Net, C#, ASP, ASP.Net, PHP, Perl, Python, Cold Fusion, PowerBuilder, FoxPro, Windev, VB and Java script as well as Java and Ruby  are provided.
  • Support Windows Vista and IE7 now
  • Support Windows X64 edition (under x64 window)
  • Convert html to text
  • Draw watermark text on image after converting html to image
  • Html Snapshot is free to try. Just try it out for FREE in your applications to convert html to image before purchase.

    Related web links:

    Guangming Software: http://www.guangmingsoft.net
    Html Snapshot:  http://www.guangmingsoft.net/htmlsnapshot/help.htm
    Html Snapshot Download: http://www.guangmingsoft.net/htmlsnapshot/HtmlSnapSetup.exe

     

    A design for large scale URL or html to image system

    Htmlsnapshot is a component to convert html or url to image. It can be used to build large scale URL to image conversion system. Here, the large means the system is designed to convert millions of URLs to image in the future.

    My recommendation for making a robust system is to use process based method.  There are a main process in the system. It maintains the list of URLs and launch child worker process to do the actual html to image conversion. Such worker process creates only one Snapshot object. It processes some URLs  (may be 1 or 10, can be predefined) and exit.

    The benefit:
    1. Each snapshot object will not affect each other. Htmlsnapshot itself is thread safe in general.  The underline webbrowser control is complex and might have concurrency issue in rare extreme condition. So this can avoid the unknown issue around threading.

    2. By wrapping snapshot function into a worker process, your main process will always have control to start/stop/terminate a worker process. Here your main process is a monitor and job dispatcher, it will be most robust. For example, it has the choice to stop the worker process when it is hung unexpectedly like downloading dialog pop up etc.
    Some may worry the performance comparing to the in-proc method. I would say for large scale conversion jobs, the robustness is more important. And the time to launch a process is a lot faster than downloading from internet.