saveAsync()

Description

Saves images in DcsBuffer to file system.

Syntax

func saveAsync(indice:[Any], filename:String, encodeParameter:DcsEncodeParameter, onSuccess:onSaveSuccess, onFailure:onSaveFailure, onProgress:onSaveProgress)

Parameters

indice:[Any] An index array for images to be saved.
filename:StringFile name for the images to be saved.
encodeParameter:DcsEncodeParameter Its value will be chosen from DcsPNGEncodeParameter, DcsJPEGEncodeParameter or DcsPDFEncodeParameter which represents to save the images as PNG, JPG or PDF files.
onSuccess:onSaveSuccess The callback function when this method performs successfully.
onFailure:onSaveFailure The callback function when this method performs unsuccessfully.
onProgress:onSaveProgress The callback function when this method pushes load progress information. This function will be triggered when one image data is processed.

Return value

Void

Remarks

encodeParameter Maximum Value Result if the value exceeds the maximum value
DcsPNGEncodeParameter 1 Save the first image as PNG file.
DcsJPEGEncodeParameter 1 Save the first image as JPG file.
DcsPDFEncodeParameter no limit Save the images as a multi-page PDF.

Exceptions

Circumstance Exception thrown
License verification failed. DcsLicenseVerificationFailedException
There is not enough memory. DcsStorageSpaceLimitException
Indices/encodeParameter/file is nil. DcsValueNotValidException
Indices include a value not smaller than DcsBuffer.count. DcsValueOutOfRangeException
typealias onSaveSuccess = (result: Any)-> void
Description This event is triggered when saveAsync function is successfully executed.
Parameter result: The source of the data. It represents the file name or the buffer stream saveAsync passed.
typealias onSaveFailure = (result: Any ,exp:DcsException)-> void
Description This event is triggered when saveAsync function is not successfully executed.
Parameter result: The source of the data. It represents the file name or the buffer stream saveAsync loaded.
exp: The exception saveAsync throws.
onSaveProgress = (progress: Int)-> Bool
Description This event is triggered when saveAsync function is executing and showing the progress.
Parameter progress: The progress of saving files.
Return When YES is returned, saveAsync will keep executing. When NO is returned, saveAsync will stop.