loadFile()

Description

Loads images or documents to DcsBuffer.

Syntax

func loadFile(file: String, mode:DcsModeEnum)

Parameters

file:String The files to be loaded in buffer in jpg, png or pdf formats with full path.
mode:DcsModeEnum The format for loading images. The values represent whether it's in an image or document format.

Return value

Void

Remarks

When the value of mode is DME_IMAGE, a new DcsImage object will be loaded into DcsBuffer.
When the value of mode is DME_DOCUMENT, a new DcsDocument object will be loaded into DcsBuffer.
If there are multiple images in one PDF file, multiple objects will be created.

Exceptions

Circumstance Exception thrown
License verification failed. DcsLicenseVerificationFailedException
There is an error reading the file. DcsFileReadException
The content of the file can't be decoded. DcsDataFormatInvalidException
File is nil DcsValueNotValidException
Mode is not DME_DOCUMENT nor DME_IMAGE. DcsValueOutOfRangeException

 

Example

class ViewController: UIViewController{
    var dcsView:DcsView!
    override func viewDidLoad() {
        super.viewDidLoad()
        dcsView = DcsView(frame: CGRect(x:0,y:0,width:self.view.frame.size.width,height:self.view.frame.size.height))
        view.addSubview(dcsView)
        dcsView.io.loadfile("<your saving path>", mode: DME_DOCUMENT)
}
Is this page helpful?

Leave a Reply

Your email address will not be published.