ConvertToBlob

Description

Converts the images of specified indices in buffer to a blob.

Syntax

.ConvertToBlob(indices, enumImageType, asyncSuccessFunc, asyncFailureFunc);

Parameters

<int[]> indices: specifies the indices of images in buffer. The index is 0-based.
EnumDWT_ImageType enumImageType: specifies the format.

Type Numeric Value
IT_BMP 0
IT_JPG 1
IT_TIF 2
IT_PNG 3
IT_PDF 4

<OnSuccess function> asyncSuccessFunc: callback function triggered when the file is converted successfully.
<OnFailure function> asyncFailureFunc: callback function triggered when the file fails to be converted.

Please refer to the function prototype OnSuccess or OnFailure.

Return value

<Blob> is returned in the callback asyncSuccessFunc().

Because this method is async only, the returned value doesn't mean if the convert succeeds or not. When convert fails, check ErrorCode or ErrorString for error information.

Remarks

This method is valid only in HTML5 Edtion

Example

JavaScript:

DWObject.ConvertToBlob ([1,3], EnumDWT_ImageType.IT_PDF, asyncSuccessFunc, asyncFailureFunc);
function asyncSuccessFunc (result) {
     console.log(result.size);
}
function asyncFailureFunc (errorCode, errorString) {
     alert("ErrorCode: "+errorCode +"\r"+"ErrorString:"+ errorString);
}

 

See also

How to upload multiple files at a time