Normally you will want to save your rendered pages using the
Save method. However sometimes you will
need to obtain your pages as raw data rather than in file format.
The GetAs function allows you to do this
You may wish to write your images direct to a client browser
rather than going through an intermediate file. The data you obtain
using GetAs can be written direct to an HTTP stream using
Response.BinaryWrite. Similarly you may wish to obtain raw data for
insertion into a database.
When you save the current page the image type is inferred from
the dummy 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
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 only a selected
portion of the page using the srcLeft, srcTop, srcWidth and
The GetAs 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.