GetSelectedImagesSize()

Description

Calculates the file size in the specified format of the selected images.

Syntax

.GetSelectedImagesSize(imageType);

Parameters

EnumDWT_ImageType (int) sImageType: specifies the format.

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

Return value

<int>

If Dynamic Web TWAIN fails to calculate the size. -1 is returned.

When an error occurs, check ErrorCode or ErrorString for error information.

Remarks

Currently this method is only valid in Windows & Mac.

If the sImageType is IT_TIF or IT_PDF, GetSelectedImagesSize() returns the total size of the selected images. Otherwise, the method returns the size of the first selected image.

See also

GetSelectedImagesSize
SetSelectedImageIndex

Example

    var imagedata;
    DWObject.SelectedImagesCount = 1;
    DWObject.SetSelectedImageIndex(0,0);
    DWObject.GetSelectedImagesSize(EnumDWT_ImageType.IT_JPG);
    imagedata = DWObject.SaveSelectedImagesToBase64Binary();
    var newImage = document.createElement('img');
    newImage.onload = function () { 
        document.getElementsByTagName('body')[0].appendChild(this);
    };
    newImage.src = "data:image/png;base64," + imagedata;
Is this page helpful?

Leave a Reply

Your email address will not be published.