Javascript: Page.getImage Method
Description
Gets an image of the page's contents as in the specified format in screen resolution.
Syntax
<void> Page.getImage(<ImageFormat> imageFormat, <Number> zoomFactor, <PageContent> contents, <RequestStringCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| imageFormat | Specifies the format used to save the image. |
| zoomFactor | Specifies a zooming factor in percent. It can be a value between 10 and 400 percent. |
| contents | Specifies the image's contents. |
| callback | Receives an image of the page's contents. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Page.getImage in a practical document-editing workflow. It gets an image of the page's contents as in the specified format in screen resolution.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function inspectImage(page) {
page.getImage(
TXTextControl.ImageFormat.Bmp,
100,
TXTextControl.PageContent.Background,
function(result) {
console.log("get image result:", result);
},
onTxError
);
}