Provide state-of-the-art image capture, screen capture, video capture and audio capture software
Home     Download     Purchase     Support     Contact     View my shopping cart
You are here: ACASystems » ACA WebThumb ActiveX Control » FAQ » Convert web page to image using Java and Eclipse
 » Home > ACA WebThumb ActiveX Control > FAQ >

How to convert web page to image using Java and Eclipse - Java Sample Code

Download ACA WebThumb ActiveX

For Windows 7/Vista/2003/XP/2000

If you are a Java developer, you may want to convert web page to image in Java project and then save it as JPEG/GIF/PNG/BMP format or directly output the image bytes in memory to client browser. To add this feature to your Java project, ACA WebThumb ActiveX is best your choice. It's a developer SDK for coverting HTML page to image, it takes the snapshots of given URLs as JPG, GIF, PNG, BMP, TIFF, WMF and EMF image. In this tutorial, we will see how to convert web page to image with Java and Eclipse environment.

Tips: ACA WebThumb ActiveX Control is a developer SDK for converting HTML web page to image. If you are looking for a windows application to coverting HTML web page to image and save HTML to JPG/PNG/GIF/TIF files, please free trial ACA HTML to Image Converter.

Guidelines: Convert web page to image using Java and Eclipse

  1. Free download ACA WebThumb ActiveX.
  2. You will find a Java demo project in the folder {install-folder}\sample\java\eclipse\.
  3. Open file Readme.txt, follow the instructions, build and lanuch it.

Note: This demo requires JDK (JRE) and Eclipse. please make sure you have installed the Java development environment

Example code: Convert web page to image using Java and Eclipse

Java script file: CSnapSample.java

import org.eclipse.swt.ole.win32.Variant;

public class CSnapSample
{
  static final String progId = "ACAWebThumb.ThumbMaker";

  public static void main(String[] argv)
  {
    System.out.println("Ready to start...");

    /**
     * Create the COM interface
     */
    CComObject t_xCom = new CComObject();
    t_xCom.CreateComObjectProgID(progId);

    /**
     * Set the license key to unlock the trial limit. To get a license, please visit: 
     *   http://www.acasystems.com/en/buynow.htm
     */
    // String t_strRegcode = "AAAAAAAAA-BBBBBBBBB-CCCCCCCCC-DDDDDDDDD";
    // t_xCom.CallFunction( "SetRegInfo", new Variant[] { new Variant(t_strRegcode) } );

    /**
     * Set the URL
     */
    String t_strURL = "http://www.google.com";
    t_xCom.CallFunction("SetURL", new Variant[] { new Variant(t_strURL) });

    /**
     * Start snap
     */
    Variant t_vRet = t_xCom.CallFunction("StartSnap");

    /**
     * Save the image
     */
    if (0 == t_vRet.getLong())
    {
      String t_strFile = "c:/google.png";
      t_xCom.CallFunction("SaveImage", new Variant[] { new Variant(t_strFile) });

      System.out.println("Completed.");
    }
    else
    {
      System.out.println("Failed.");
    }

    /**
     * release
     */
    t_xCom.dispose();
  }
}
Download ACA WebThumb ActiveX

For Windows 7/Vista/2003/XP/2000

Other resource about Converting web page to image using Java and Eclipse:


Get discount alerts, new product information and technical articles:
Name:
Email:
* Get 10% off your first order by joining our mailing list!
* You may safely unsubscribe at any time!