Skip to main content
Version: 2025.2

previewImage

Collection of functions for creating a preview image for a specific document.

Methods​

createPreviewImage​

createPreviewImage(pData): string

Creates a preview image in PNG format for a specific document. For the size, the setting for blobPreviewSize in the Preferences under database is used. If nothing is set or both height and width are set to 0, no image is created.

Parameters​

pData
string | number | boolean

the document as an base64 encoded byte[]

Returns​

string

The preview image as an base64 encoded byte[]

Throws​

May throw an exception.


getPreviewImage​

getPreviewImage(pData, pFormat, pWidth, pHeight): string

Generates a preview image for a given document.

Parameters​

pData
string | number | boolean

the document as an base64 encoded byte[]

pFormat
string | number | boolean

the format in wich the picture shall be created (eg.: "PNG")

pWidth
number

the width of the preview image, if the image width would be smaller than the given width the original width will be used

pHeight
number

the heigt of the preview image, if the image height would be smaller than the given height the original heigt will be used

Returns​

string

The preview image as an base64 encoded byte[]

Throws​

May throw an exception.

Properties​

FORMAT_JPG​

string

String constant for the picture format JPG. Application example

Example​

var image = previewImage.getPreviewImage(data, previewImage.FORMAT_JPG, 300, 200);

FORMAT_PNG​

string

String constant for the picture format PNG. Application example

Example​

var image = previewImage.getPreviewImage(data, previewImage.FORMAT_PNG, 300, 200);