convertToBase64()

Description

Converts the images of specified indices in the buffer to a base64 string.

Syntax

ImageViewerObject.io.convertToBase64(indices, imageType);

Parameters

<int[]> indices: specifies the indices of images to be saved.
<EnumImageType> imageType: specifies the format.

Image Type     Allowed Value
BMP     EnumImageType.BMP
JPEG     EnumImageType.JPEG
TIFF     EnumImageType.TIFF
PNG     EnumImageType.PNG
PDF     EnumImageType.PDF

Return value

<string>

The result string is the pure base64 string with no extra info. For example,
"/9j/4AAQSkZJRgABA...".
To use the string in most circumstances, you need to add extra info like
data:image/png;base64,"/9j/4AAQSkZJRgABA...".

Remarks

EnumImageType is under namespace io.

EnumImageType.JPEG doesn't support B/W images.

Example

var imagedata;
var imageviewer = DCSObject.getImageViewer("ImageViewerContainer");  // Get a specified image viewer
imagedata = imageviewer.io.convertToBase64([0,2], imageviewer.io.EnumImageType.PDF);

See also

.image.setSelectedIndices()