loadDataAsync()

Description

Loads images from buffer asynchronously and converts them to dcsImage or dcsDocument in DcsBuffer according to the value of mode.

Syntax

func loadDataAsync(data:Data, mode:DcsModeEnum, onSuccess:onLoadSuccess, onFailure:onLoadFailure)

Parameters

data:Data The data in the buffer in jpg, png or pdf formats.
mode:DcsModeEnum The format for loading images. The values represent whether it's in an image or document format.
onSuccess:onLoadSuccess The callback function when this method performs successfully.
onFailure:onLoadFailure The callback function when this method performs unsuccessfully.
onProgress:onLoadProgress The callback function when this method pushes load progress information. This parameter is mainly used for processing multi-page PDF. This function will be triggered when a number of PDF files are loaded. When false is returned, the loading will be terminated.

Return value

Void

Exceptions

Circumstance Exception thrown
License verification failed. DcsLicenseVerificationFailedException
There is error decoding the data DcsDataFormatInvalidException
Data is nil DcsValueNotValidException
Mode is not DME_DOCUMENT nor DME_IMAGE. DcsValueOutOfRangeException
onLoadSuccess = (source: Any) -> Void
Description This event is triggered when loadAsync function is successfully executed.
Parameter source: The source of the data. It represents the file name or the buffer stream loadAsync loaded.
typealias onLoadFailure = (source: Any, exp: DcsException) -> Void
Description This event is triggered when loadAsync function is not successfully executed.
Parameter source: The source of the data. It represents the file name or the buffer stream loadAsync loaded.
exp: The exception loadAsync throws.
onLoadProgress = (progress: Int) -> Bool
Description This event is triggered when loadAsync function is executing and showing the progress.
Parameter progress: The progress of loading files.
Return When YES is returned, loadAsync will keep executing. When NO is returned, loadAsync will stop.
Is this page helpful?

Leave a Reply

Your email address will not be published.