ISnapShooter Interface Reference
[HtmlCapture ActiveX Control]

Interface of HtmlCapture version 1.0 (deprecated). More...

List of all members.

Snap functions

Functions to take snapshots.

HtmlCaptureResult SnapUrl (string strUrl)
 Take a snapshot for the specified URL.
HtmlCaptureResult SnapHtmlString (string strHtml)
 Take a snapshot for html text.
HtmlCaptureResult ReSnap ()
 Repeat the last Snap operation (SnapUrl() or SnapHtmlString()).
HtmlCaptureResult SnapWebBrowser (IDispatch *pWebBrowser)
 Take snapshot for an existing web browser.
void Stop ()
 Cancel the snap job.

Image access functions

Functions to access the resulting image.

bool SaveImage (string strFileName)
 Save the snap's resulting image to a local file after a snap function succeeds.
byte[] GetImageBytes (string strFormat)
 Get the in-memory image bytes after a snap function succeeds.
long GetBmpHandle ()
 Get the HBITMAP handle to the resulting image.
long GetEmfHandle ()
 Get the HENHMETAFILE handle to the resulting image.
bool SaveMultiPageTiff (string strFileName, long nPageHeight)
 Save the snap's resulting image to multi-page TIFF file after a snap function succeeds.
void GetImageSize (long *pWidth, long *pHeight)
 Get the size of resulting image.

Snap options

Get/set options that affects snap.

long GetTimeOut ()
 Get the time out value in milliseconds for snap functions.
void SetTimeOut (long nTimeOut)
 Set the time out value in milliseconds for snap functions.
long GetDelayTime ()
 Get the time value in milliseconds to wait for after a html document is downloaded.
void SetDelayTime (long nDelayTime)
 Set the time value in milliseconds to wait for after a html document is downloaded.
float GetZoomRatio ()
 Get the zoom ratio of the html page when taking snapshot.
void SetZoomRatio (float fZoomRatio)
 Set the zoom ratio of the html page when taking snapshot.
bool GetActiveXEnabled ()
 Get if ActiveX is enabled (visible) on a web page.
void SetActiveXEnabled (bool bEnabled)
 Set if ActiveX is enabled (visible) on a web page.
bool GetImageEnabled ()
 Get if images are enabled (visible) on a web page.
void SetImageEnabled (bool bEnabled)
 Set if images are enabled (visible) on a web page.
bool GetJavaEnabled ()
 Get if java applets are enabled on a web page.
void SetJavaEnabled (bool bEnabled)
 Set if java applets are enabled on a web page.
bool GetScriptEnabled ()
 Get if scripts are enabled (can be executed) on a web page.
void SetScriptEnabled (bool bEnabled)
 Set if scripts are enabled (can be executed) on a web page.
bool GetVideoEnabled ()
 Get if videos are enabled (visible) on a web page.
void SetVideoEnabled (bool bEnabled)
 Set if videos are enabled (visible) on a web page.
void GetMinBrowserSize (long *pWidth, long *pHeight)
 Get the minimum size of the hidden web browser window.
void SetMinBrowserSize (long nWidth, long nHeight)
 Set the minimum size of the hidden web browser window.
string GetStartupScript ()
 Get the JScript code to be executed before each Snap (after document downloaded).
void SetStartupScript (string strScript)
 Set the JScript code to be executed before each Snap (after document downloaded).
string GetCookies ()
 Get the cookies of the webpage just snapped.
void SetCookies (string strUrl, string strCookies)
 Set cookie(s) for the specified url.
void SetPostData (string strPostData)
 Set post data.
string GetPostData ()
 Get the post data currently set.

Image access options

Get/set options that affects image access.

void GetClipRect (long *pLeft, long *pTop, long *pWidth, long *pHeight)
 Get the clip rect to the resulting image.
void SetClipRect (long nLeft, long nTop, long nWidth, long nHeight)
 Set the clip rect to the resulting image.
void GetThumbSize (long *pWidth, long *pHeight, bool *pKeepRatio)
 Get the preset thumbnail image size.
void SetThumbSize (long nWidth, long nHeight, bool bKeepRatio)
 Set thumbnail image size.
long GetBpp ()
 Get color depth of the resulting image.
void SetBpp (long nBpp)
 Set color depth of the resulting image.
void GetDPI (long *pDpiX, long *pDpiY)
 Get resolution for TIFF, JPEG, PNG and BMP image formats.
void SetDPI (long nDpiX, long nDpiY)
 Set resolution for TIFF, JPEG, PNG and BMP image formats.
byte GetJpegQuality ()
 Get JPEG quality when saving image as JPEG.
void SetJpegQuality (byte nQuality)
 Set JPEG quality when saving image as JPEG.
HtmlCaptureTiffEncoder GetTiffEncoder ()
 Get the TIFF encoder when saving image as TIFF format.
void SetTiffEncoder (HtmlCaptureTiffEncoder nEncoder)
 Set the TIFF encoder when saving image as TIFF format.
HtmlCaptureGifEncoder GetGifEncoder ()
 Get the GIF encoder when saving image as GIF format.
void SetGifEncoder (HtmlCaptureGifEncoder nEncoder)
 Set the GIF encoder when saving image as GIF format.
HtmlCaptureDitherMethod GetDitherMethod ()
 Get the dither method when converting image to B&W.
void SetDitherMethod (HtmlCaptureDitherMethod nMethod)
 Set the dither method when converting image to B&W.
long GetThreshold ()
 Get the threshold value for converting image to B&W.
void SetThreshold (long nThreshold)
 Set the threshold value for converting image to B&W.
bool GetErrorDiffusion ()
 Get if using error diffusion algorithm when decreasing Bpp .
void SetErrorDiffusion (bool bErrorDiff)
 Set if using error diffusion algorithm when decreasing Bpp .
bool GetOptimalPalette ()
 Get if using an optimal palette when decreasing Bpp .
void SetOptimalPalette (bool bOptimalPal)
 Set if using an optimal palette when decreasing Bpp .
bool GetGrayScale ()
 Get if converting resulting image to gray scale in the next SaveImage(), GetImageBytes() or GetBmpHandle() call.
void SetGrayScale (bool bGrayScale)
 Set if converting resulting image to gray scale in the next SaveImage(), GetImageBytes() or GetBmpHandle() call.
bool GetBlackAndWhite ()
 Get if converting resulting image to B&W in the next SaveImage(), GetImageBytes() or GetBmpHandle() call.
void SetBlackAndWhite (bool bBAndW)
 Set if converting resulting image to B&W in the next SaveImage(), GetImageBytes() or GetBmpHandle() call.
HtmlCaptureInterpolationMode GetInterpolationMode ()
 Get the interpolation mode when resizing an image.
void SetInterpolationMode (HtmlCaptureInterpolationMode nMode)
 Set the interpolation mode when resizing an image.

HTML utility functions

Some utility functions to retrieve information about the webpage.

string GetDocumentTitle ()
 Get the title of the web page just snapped.
string GetDocumentSource ()
 Get the html source of the web page just snapped.
string[] GetDocumentLinks ()
 Get the URLs of links on the web page just snapped.
string[] GetDocumentFrames ()
 Get the URLs of frames on the web page just snapped.
string GetDocumentText ()
 Get the text content of the web page just snapped.
IDispatch * GetHtmlDocument ()
 Get WebBrowser's html document dispatch interface.

Other functions



string GetReserved (string strIdx)
 Get reserved properties.
void SetReserved (string strIdx, string newVal)
 Set reserved properties.
void SetRegInfo (string strUserName, string strRegCode)
 Set registration info.


Detailed Description

Interface of HtmlCapture version 1.0 (deprecated).

Member Function Documentation

HtmlCaptureResult SnapUrl ( string  strUrl  ) 

Take a snapshot for the specified URL.

The function navigates a hidden WebBrowser to the specified URL and takes a snapshot for the web page. The resulting image can be saved to file or copied to memory. To take a snapshot for a html string, call SnapHtmlString().

Parameters:
strUrl The URL of the web page to be taken snapshot. For example, http://www.polestarsoft.com or file:///C:/test.htm
Returns:
If the function succeeds, the return value is HCR_SUCCESS.
Return values other than HCR_SUCCESS indicates an error, see HtmlCaptureResult.
Remarks:
This function is a synchronous function, i.e., it blocks the execution of current thread until the snap is completed or failed. Instead of calling Sleep() Win32 API, this function runs a message loop to wait. So windows message can still be processed when SnapUrl() is executing. Call Stop() in a message handler to cancel the execution of SnapUrl() and its return value will be HCR_USER_INTERRUPT.

Once SnapUrl() succeeds, the resulting image can be accessed via calling the image access functions.
There are several options that affects the resulting image of SnapUrl(), and must be set before SnapUrl() call to take effects, see Snap options.
See also:
HtmlCaptureResult, Stop, SaveImage, GetImageBytes, SnapHtmlString

HtmlCaptureResult SnapHtmlString ( string  strHtml  ) 

Take a snapshot for html text.

The function is the same as SnapUrl() except that it takes html text as parameter, not URL. It operates entirely in memory, no temporary files used.

Parameters:
strHtml The string contains html text.
Returns:
If the function succeeds, the return value is HCR_SUCCESS.
Return values other than HCR_SUCCESS indicates an error, see HtmlCaptureResult.
See also:
HtmlCaptureResult, SnapUrl

HtmlCaptureResult ReSnap (  ) 

Repeat the last Snap operation (SnapUrl() or SnapHtmlString()).

Returns:
If the function succeeds, the return value is HCR_SUCCESS.
Return values other than HCR_SUCCESS indicate an error, see HtmlCaptureResult.
Remarks:
HtmlCapture saves the parameter of your last SnapUrl() or SnapHtmlString() call internal. This function equals to call SnapUrl(LASTURL) or SnapHtmlString(LAST_HTML_STRING).
See also:
HtmlCaptureResult, SnapUrl, SnapHtmlString

HtmlCaptureResult SnapWebBrowser ( IDispatch *  pWebBrowser  ) 

Take snapshot for an existing web browser.

Parameters:
pWebBrowser An IWebBrowser2 interface pointer of the existing web browser.
Returns:
If the function succeeds, the return value is HCR_SUCCESS, else HCR_SNAP_ERROR.
Remarks:
Once SnapWebBrowser() succeeds, the resulting image can be accessed via calling the image access functions.
Note:
SnapWebBrowser works in different way from SnapUrl.
See also:
SnapUrl

void Stop (  ) 

Cancel the snap job.

If SnapUrl(), SnapHtmlString() or ReSnap() is called and blocked, Stop() make them return at once.

Remarks:
Snap functions like SnapUrl(), SnapHtmlString() and ReSnap() run a message loop and block the execution of current thread. This function can be used to break the message loop and make Snap functions return at once. The return value of these snap functions will be HCR_USER_INTERRUPT if Stop() is called.
See also:
SnapUrl, SnapHtmlString, ReSnap

bool SaveImage ( string  strFileName  ) 

Save the snap's resulting image to a local file after a snap function succeeds.

Parameters:
strFileName The image file name. Since this function uses the extension name to determine image format, it must end with an extension name, for example: "c:\snapshot1.jpg", "d:\snapshot.png", etc.
Returns:
If image is successfully saved, the return value is true, else false.
Remarks:
This function saves the snap image to a local file. Call this function when a snap function succeeds. To retrieve image data in memory, call GetImageBytes(). To get an HBITMAP or an HENHMETAFILE handle, call GetBmpHandle() and GetEmfHandle() respectively.

The following pseudo codes show how to take a snapshot for a URL and save it to local file.
 ISnapShooter snap;
 if (snap.SnapUrl("http://www.polestarsoft.com") == HCR_SUCCESS)
 {
     if(snap.SaveImage("c:\\snapshot.png"))
         MessageBox("Snapshot saved.");
 }

HtmlCapture Supports following image formats.

  • raster images
    • BMP
    • GIF
    • JPG
    • PCX
    • PNG
    • TGA
    • TIF
  • vector images
    • WMF
    • EMF

Please make sure strFileName is ended with a valid extension name (listed above), or this function will fail.
There are several properties affects the saving of image, and must be set before calling SaveImage() to take effects. See Image access options.
By setting corresponding options, and call SaveImage(), you can get image in a clip rect, thumbnail image, gray scale image or B&W image, etc.
See also:
GetImageBytes, GetBmpHandle, GetEmfHandle, SnapUrl, SnapHtmlString

byte [] GetImageBytes ( string  strFormat  ) 

Get the in-memory image bytes after a snap function succeeds.

In this way, you can convert html to image in memory.

Parameters:
strFormat A string that represents the image format. For example: "PNG", "WMF". For a list of image formats supported, see SaveImage.
Returns:
A bytes array contains the resulting image's in-memory data.
Remarks:
This function is similar to SaveImage(). The difference between these two functions is SaveImage() saves resulting image to a local file, while GetImageBytes() saves resulting image to a byte array.

There are several properties affects the saving of image, and must be set before calling SaveImage() to take effects. See Image access options.
See also:
SaveImage, SnapUrl

long GetBmpHandle (  ) 

Get the HBITMAP handle to the resulting image.

Call this function after a snap function succeeds. The returned bitmap is also affected by those image access options. If you want them to take effects, set them before call this function.

Returns:
If this function succeeds, the return value is a HBITMAP handle. If the function fails, the return value is NULL.
Note:
If the return value is not NULL, you need to free the returned bitmap handle with DeleteObject Win32 API.
Remarks:
This function retrieves a HBITMAP handle (a GDI object). It can be used as a normal GDI object. If you want to get a HENHMETAFILE handle, call GetEmfHandle() instead.

The following pseudo codes show how to take a snapshot for a URL and draw it on a picture box.
 ISnapShooter snap;
 if (snap.SnapUrl("http://www.polestarsoft.com") == HCR_SUCCESS)
 {
     HBITMAP hbmp = (HBITMAP)snap.GetBmpHandle();
     if (hbmp != NULL)
     {
         pictureBox.SetBitmap(hbmp);    //picture box is a CStatic variable
         //we need not to call DeleteObject(hbmp), since pictureBox will delete it.
     }
 }

See also:
GetEmfHandle, SaveImage

long GetEmfHandle (  ) 

Get the HENHMETAFILE handle to the resulting image.

Call this function after a snap function succeeds. The returned meta file is also affected by those image access options. If you want them to take effects, set them before call this function.

Returns:
If this function succeeds, the return value is a HENHMETAFILE handle. If the function fails, the return value is NULL.
Note:
If the return value is not NULL, you need to free the returned meta file with DeleteEnhMetafile Win32 API.
Remarks:
This function retrieves a HENHMETAFILE handle. Since EMF images are vector images, they can shrink and grow with no distortion. If you want to get a raster image handle, call GetBmpHandle() instead.

The following pseudo codes show how to take a snapshot for a URL and draw it on a window using GetEmfHandle().
 ISnapShooter snap;
 if (snap.SnapUrl("http://www.polestarsoft.com") == HCR_SUCCESS)
 {
     HENHMETAFILE hemf = (HENHMETAFILE)snap.GetEmfHandle();
     if (hemf != NULL)
     {
         CRect rc;
         GetClientRect(&rc);            //get client rect of this window
         CDC* pDC = GetDC();            //get drawing context
         PlayEnhMetaFile(pDC->m_hDC, hemf, &rc);        //draw it
         DeleteEnhMetafile(hemf);
     }
 }

See also:
GetBmpHandle, SaveImage

bool SaveMultiPageTiff ( string  strFileName,
long  nPageHeight 
)

Save the snap's resulting image to multi-page TIFF file after a snap function succeeds.

If the resulting image's height is greater than nPageHeight, it will be split into several pages and added to a multi-page TIFF file.

Parameters:
strFileName The image file name.
nPageHeight Max height of a TIFF page.
Returns:
If image is successfully saved, the return value is true, else false.
See also:
SnapUrl, SaveImage, SetTiffEncoder

void GetImageSize ( long *  pWidth,
long *  pHeight 
)

Get the size of resulting image.

Call this function after a snap function succeeds.

Parameters:
pWidth A pointer to retrieve image width.
pHeight A pointer to retrieve image height.
See also:
SnapUrl, SaveImage

long GetTimeOut (  ) 

Get the time out value in milliseconds for snap functions.

TimeOut property can be used to avoid hang.

Returns:
TimeOut value in milliseconds. The default TimeOut value is 30000.
See also:
SetTimeOut

void SetTimeOut ( long  nTimeOut  ) 

Set the time out value in milliseconds for snap functions.

TimeOut property can be used to avoid hang.

Parameters:
nTimeOut TimeOut value in milliseconds. A negative value or zero indicates infinite.
Remarks:
A snap call will return HCR_TIMEOUT if the snap is still not completed after TimeOut milliseconds from its startup. You can call SetTimeOut() with nTimeOut=-1 to disable TimeOut, then snap functions will not return until it completes or fails.
See also:
GetTimeOut

long GetDelayTime (  ) 

Get the time value in milliseconds to wait for after a html document is downloaded.

Sometimes, a web page contains ActiveX or java applet, which takes time to initialize.

Returns:
time value in milliseconds to wait for after a html document is downloaded. Default value is 1000
See also:
SetDelayTime

void SetDelayTime ( long  nDelayTime  ) 

Set the time value in milliseconds to wait for after a html document is downloaded.

Sometimes, a web page contains ActiveX or java applet, which takes time to initialize.

Parameters:
nDelayTime Time value in milliseconds to wait for after a html document is downloaded. Default value is 1000
See also:
GetDelayTime

float GetZoomRatio (  ) 

Get the zoom ratio of the html page when taking snapshot.

Default value is 1.0.

Returns:
A float value indicates the zoom ratio.
See also:
SetZoomRatio

void SetZoomRatio ( float  fZoomRatio  ) 

Set the zoom ratio of the html page when taking snapshot.

Default value is 1.0.

Parameters:
fZoomRatio A float value indicates the zoom ratio.
Remarks:
  • If fZoomRatio<1, it will result in a small image
  • If fZoomRatio>1, it will result in a large image.
  • If fZoomRatio<0, the function fails.

One of the differences between SetZoomRatio(), SetThumbSize(), and SetClipRect() is SetZoomRatio() affects snap functions (e.g. SnapUrl()), while SetThumbSize() and SetClipRect() only affect image access functions (e.g. SaveImage()).

Thus SetZoomRatio() has to be called before calling snap functions, while SetThumbSize() and SetClipRect() have to be called before calling image access functions to take effects.

The priorities of these three properties are: SetZoomRatio() > SetClipRect() > SetThumbSize() If you call SetZoomRatio() several times before a snap call, only the last one takes effect.
See also:
GetZoomRatio, SetThumbSize, SetClipRect, SnapUrl, SaveImage

bool GetActiveXEnabled (  ) 

Get if ActiveX is enabled (visible) on a web page.

Default value is TRUE.

See also:
SetActiveXEnabled

void SetActiveXEnabled ( bool  bEnabled  ) 

Set if ActiveX is enabled (visible) on a web page.

Default value is TRUE.
If ActiveXEnabled is set to FALSE, then ActiveX controls on a web page will not be downloaded, which is useful to decrease download time, so as to decrease snap time.

See also:
GetActiveXEnabled

bool GetImageEnabled (  ) 

Get if images are enabled (visible) on a web page.

Default value is TRUE.

See also:
SetImageEnabled

void SetImageEnabled ( bool  bEnabled  ) 

Set if images are enabled (visible) on a web page.

Default value is TRUE.
If ImageEnabled is set to FALSE, images on a web page will not be downloaded and displayed, which is useful to decrease downloading time, so as to decrease snap time.

See also:
GetImageEnabled

bool GetJavaEnabled (  ) 

Get if java applets are enabled on a web page.

Default value is TRUE.

See also:
SetJavaEnabled

void SetJavaEnabled ( bool  bEnabled  ) 

Set if java applets are enabled on a web page.

Default value is TRUE.
If JavaEnabled is set to FALSE, java applets on a web page will not be downloaded, which is useful to decrease downloading time, so as to decrease snap time.

See also:
GetJavaEnabled

bool GetScriptEnabled (  ) 

Get if scripts are enabled (can be executed) on a web page.

Default value is TRUE.

See also:
SetScriptEnabled

void SetScriptEnabled ( bool  bEnabled  ) 

Set if scripts are enabled (can be executed) on a web page.

Default value is TRUE.

Note:
If ScriptEnabled is set to FALSE, No scripts on a web page will be executed. This may lead to a disordered image.
See also:
GetScriptEnabled

bool GetVideoEnabled (  ) 

Get if videos are enabled (visible) on a web page.

Default value is TRUE.

See also:
SetVideoEnabled

void SetVideoEnabled ( bool  bEnabled  ) 

Set if videos are enabled (visible) on a web page.

Default value is TRUE.
If VideoEnabled is set to FALSE, videos on a web page will not be downloaded and displayed, which is useful to decrease downloading time, so as to decrease snap time.

See also:
GetVideoEnabled

void GetMinBrowserSize ( long *  pWidth,
long *  pHeight 
)

Get the minimum size of the hidden web browser window.

Parameters:
pWidth A pointer to retrieve minimum width in pixels. Default value is 800.
pHeight A pointer to retrieve minimum height in pixels. Default value is 600.
See also:
SetMinBrowserSize

void SetMinBrowserSize ( long  nWidth,
long  nHeight 
)

Set the minimum size of the hidden web browser window.

Parameters:
nWidth Minimum width in pixels. Default value is 800.
nHeight Minimum height in pixels. Default value is 600.
Remarks:
This function affects the size of resulting image. Taking no account of SetZoomRatio(), SetClipRect() and SetThumbSize(), the resulting image size: SizeOfImage = MAX( MinBrowserSize, WebPageSize ).

Set MinBrowserSize to (0, 0) will make MinBrowserSize take no effects.
See also:
GetMinBrowserSize

string GetStartupScript (  ) 

Get the JScript code to be executed before each Snap (after document downloaded).

Returns:
The startup JScript code.
See also:
SetStartupScript

void SetStartupScript ( string  strScript  ) 

Set the JScript code to be executed before each Snap (after document downloaded).

This function is helpful if you want do some initialization job before snap. The JScript will be executed after the document is fully downloaded.

The following pseudo codes show how to set startup script.

 ISnapShooter snap;
 snap.SetStartupScript("document.linkColor = '#FF0000'");               //the javascript turns the link color to red
 if (snap.SnapUrl("http://www.polestarsoft.com") == HCR_SUCCESS)
 {
     ...
 }

See also:
GetStartupScript

string GetCookies (  ) 

Get the cookies of the webpage just snapped.

Call this function after a snap function succeeds.

Returns:
Cookie string in "name=value;" pairs.
Remarks:
A cookie is string of "name=value;" pairs, plus any of following values
  • "secure;"
  • "expires=date;"
  • "domain=domainname;"
  • "path=path;"
See also:
SetCookies

void SetCookies ( string  strUrl,
string  strCookies 
)

Set cookie(s) for the specified url.

Call this function before a snap function to take effects.

Parameters:
strUrl The URL of web page whose cookies is to be set.
strCookies Cookies string to be set in "name1=value1;name2=value2;..." format.
Remarks:
A Cookie is a string of "name=value;", plus any of following values
  • "secure;"
  • "expires=date;"
  • "domain=domainname;"
  • "path=path;"
See also:
GetCookies

void SetPostData ( string  strPostData  ) 

Set post data.

Note:
If your post data is ASCII string, then use it as param directly. If your post data contains unicode character, you should encode it yourself to ensure each character in strPostData is within 0-255.

string GetPostData (  ) 

Get the post data currently set.

See also:
SetCookies

void GetClipRect ( long *  pLeft,
long *  pTop,
long *  pWidth,
long *  pHeight 
)

Get the clip rect to the resulting image.

The default clip rect is (0, 0, 0, 0).

See also:
SetClipRect

void SetClipRect ( long  nLeft,
long  nTop,
long  nWidth,
long  nHeight 
)

Set the clip rect to the resulting image.

Parameters:
nLeft X-coordinate of the TopLeft point.
nTop Y-coordinate of the TopLeft point.
nWidth Width of the clip rect.
nHeight Height of the clip rect.
Remarks:
Call this function after a snap function succeeds. This method affects all image access functions.
Call this function if you want to get/save part of the resulting image. SetClipRect(0, 0, 0, 0) will clear the clip rect.
See also:
GetClipRect, SetZoomRatio, SaveImage, GetImageBytes, GetBmpHandle

void GetThumbSize ( long *  pWidth,
long *  pHeight,
bool *  pKeepRatio 
)

Get the preset thumbnail image size.

Parameters:
pWidth A pointer to retrieve thumbnail image width.
pHeight A pointer to retrieve thumbnail image height
pKeepRatio A pointer to retrieve if thumbnail image should keep width/height ratio.
See also:
SetThumbSize, SetInterpolationMode

void SetThumbSize ( long  nWidth,
long  nHeight,
bool  bKeepRatio 
)

Set thumbnail image size.

Parameters:
nWidth Width of thumbnail image.
nHeight Height of thumbnail image.
bKeepRatio If keeps width/height ratio when getting or saving a thumbnail image.
Remarks:
image access functions like SaveImage(), GetImageBytes(), GetBmpHandle() and GetEmfHandle() can save or get both full size images and thumbnail ones. If you call SetThumbSize() first, SaveImage() will save a thumbnail image.

Calling SetThumbSize() with nWidth=0 and nHeight=0 will disable thumbnail image. And next time SaveImage() or GetImageBytes() will save or get a full size image.
The following pseudo codes show how to take a snapshot for a URL and save the result as a thumbnail image.
 ISnapShooter snap;
 if (snap.SnapUrl("http://www.polestarsoft.com") == HCR_SUCCESS)
 {
     snap.SetThumbSize(300, 300, TRUE);
     snap.SaveImage("c:\\thumbnail.png");
     snap.SetThumbSize(0, 0, FALSE);            //disable thumbnail image.
     snap.SaveImage("c:\\fullsize.png");
 }

long GetBpp (  ) 

Get color depth of the resulting image.

See also:
SetBpp

void SetBpp ( long  nBpp  ) 

Set color depth of the resulting image.

Since this method affects SaveImage(), GetImageBytes() and GetBmpHandle(), call it before them to take effects.

Note:
Call this method will make SetGrayScale() and SetBlackAndWhite() disable.
Parameters:
nBpp the color depth to be set. Valid Bpp value is 1/4/8/24
Remarks:
This function is helpful to set color depth and number of colors for an image.

  • If Bpp is set to 1, the final image will be B&W, this equals to call SetBlackAndWhite(TRUE).
  • If Bpp is set to 4, the final image will have 16 colors at most.
  • If Bpp is set to 8, the final image will have 256 colors at most.
  • If Bpp is set to 24, the final image will be RGB image (i.e. 24bits image).

Since the initial image after snap is 24bits, setting Bpp to values other than 24 will result in reducing color number. For best quality of the resulting image after reducing color, set both OptimalPalette and ErrorDiffusion to TRUE. Set both of them to FALSE for good speed.
Note:
This function has no effects on WMF and EMF images. It has kinds of effects on GIF, JPG and TGA images.
  • GIF supports 256 colors at most, so set Bpp to 256+ will have no effects.
  • JPG supports gray scale and RGB colors only, so set Bpp to values other than 8 and 24 will have no effects.
  • TGA supports 8bits and 24bits colors only, so set Bpp to values other than them will have no effects.
See also:
GetBpp, SaveImage, GetImageBytes, GetBmpHandle, SetOptimalPalette, SetErrorDiffusion

void GetDPI ( long *  pDpiX,
long *  pDpiY 
)

Get resolution for TIFF, JPEG, PNG and BMP image formats.

See also:
SetDPI

void SetDPI ( long  nDpiX,
long  nDpiY 
)

Set resolution for TIFF, JPEG, PNG and BMP image formats.

See also:
GetDPI

byte GetJpegQuality (  ) 

Get JPEG quality when saving image as JPEG.

See also:
SetJpegQuality

void SetJpegQuality ( byte  nQuality  ) 

Set JPEG quality when saving image as JPEG.

If the destination image format is JPEG, call this function before SaveImage() and GetImageBytes() to take effects.

Parameters:
nQuality JPEG quality from 1 to 100.
See also:
GetJpegQuality, SaveImage, GetImageBytes

HtmlCaptureTiffEncoder GetTiffEncoder (  ) 

Get the TIFF encoder when saving image as TIFF format.

Returns:
A HtmlCaptureTiffEncoder value indicates TIFF encoder. Default value is HCTE_LZW.
See also:
HtmlCaptureTiffEncoder, SetTiffEncoder.

void SetTiffEncoder ( HtmlCaptureTiffEncoder  nEncoder  ) 

Set the TIFF encoder when saving image as TIFF format.

Parameters:
nEncoder A HtmlCaptureTiffEncoder value indicates TIFF encoder.
Remarks:
This function affects SaveImage() and