Save a rendered copy of the page.

 

   
Syntax
 
     

Doc.Save path, [width], [height], [quality], [srcLeft], [srcTop], [srcWidth], [srcHeight]

 

   
Params
 
     
Name   Type   Description
path String

The destination file path.

width Integer

The optional width of the final output image. The default is the width of the HTML page.

height Integer

The optional height of the final output image. The default is the height of the HTML page.

quality Integer

The optional quality of the final output image ranging from 0 to 100. The default is 75.

srcLeft Integer

The optional left coordinate of the source rectangle on the HTML page from which content is to be rendered. The default is 0.

srcTop Integer

The optional top coordinate of the source rectangle on the HTML page from which content is to be rendered. The default is 0.

srcWidth Integer

The optional width of the source rectangle on the HTML page from which content is to be rendered. The default is the width of the page.

srcHeight Integer

The optional height of the source rectangle on the HTML page from which content is to be rendered. The default is the height of the page.

 

   
Notes
 
     

Use this method to save the current page as an image. The supplied path is used as the destination. Any existing file will be overwritten.

When you save the current page the image type is inferred from the file path you specify. You can save as BMP, JPEG, GIF, TIFF or PNG.

The width and height of the output image default to the width and height of the page. If you specify a different width and height the contents of the page will be scaled to fit the new image size.

The quality of the output image defaults to 75. This provides a good compromise between image quality and size for JPEG output. You can override this quality using the quality parameter.

The source rectangle for the image defaults to the entire area of the HTML page. However you can choose to draw a selected portion of the page using the srcLeft, srcTop, srcWidth and srcHeight parameters.

The Save method will not return until all the resources required by the page are fully loaded or the timeout expires. If the timeout expires before all the resources are fully loaded you may get an incomplete page rendered. You can exert finer control over the page load process using the Load method and the Timeout, Loaded and Loading properties.

If you need to obtain a page as raw data you can use the GetAs function.

 

   
Example
 
     

The following code illustrates how one might save two different rendered versions of a page. The first is a scaled down version of the entire page. The second is a scaled down version of just the central portion of the page.

Set thePage = Server.CreateObject("ABCDrawHTML.Page")
thePage.URL = "http://www.whitehouse.gov/"
thePage.Width = 800
thePage.Height = 600
thePath = Server.MapPath("wh1.jpg")
thePage.Save thePath, 200, 150, 50
thePath = Server.MapPath("wh2.jpg")
thePage.Save thePath, 200, 150, 50, 200, 150, 400, 300


wh1.jpg


wh2.jpg