Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

Processing a Single Image

Method Description
captureFromFile Capture data from the file specified by the file path.
captureFromFileBytes Capture data from a given file in memory.
captureFromBuffer Capture data from the memory buffer via a DSImageData object.
captureFromImage Capture data from the given image.

captureFromFile

Capture data from the file specified by the file path. To learn more about what the captured data can be, please see the Return Value section below.

  • Objective-C
  • Swift
  1. - (nullable DSCapturedResult *)captureFromFile:(NSString *)file
                                  templateName:(nonnull NSString*)templateName
                                         error:(NSError *_Nullable *_Nullable)error;
    
  2. func captureFromFile(_ file:String, templateName:String) throws -> CaptureResult
    

Parameters

file: The file path and name that you want to capture data from.
templateName: Specify a template with a templateName for the data capturing.
error: An NSError pointer. If an error occurs, it will represent the error information.

Possible errors:

Error Code Value Description
EC_FILE_NOT_FOUND -10005 The file is not found.
EC_FILE_TYPE_NOT_SUPPORTED -10006 The file type is not supported.
EC_TIMEOUT -10026 The processing timeout. If not all the tasks are timeout, you will still receive the results of the processed tasks.
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.
EC_MULTI_PAGES_NOT_SUPPORTED -10066 The api does not support multi-page files. Please use FileFetcher instead.

Return Value

A DSCapturedResult object.

captureFromFileBytes

Capture data from a given file in memory. To learn more about what the captured data can be, please see the Return Value section below.

  • Objective-C
  • Swift
  1. - (nullable DSCapturedResult *)captureFromFileBytes:(NSData *)fileBytes
                                       templateName:(nonnull NSString*)templateName
                                              error:(NSError *_Nullable *_Nullable)error;
    
  2. func captureFromFileBytes(_ fileBytes:Data, templateName:String) throws -> CaptureResult
    

Parameters

fileBytes: A NSData object that points to a file in memory.
templateName: Specify a template with a templateName for the data capturing.
error: An NSError pointer. If an error occurs, it will represent the error information.

Possible errors:

Error Code Value Description
EC_TIMEOUT -10026 The processing timeout. If not all the tasks are timeout, you will still receive the results of the processed tasks.
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.
EC_MULTI_PAGES_NOT_SUPPORTED -10066 The api does not support multi-page files. Please use FileFetcher instead.

Return Value

A DSCapturedResult object.

captureFromBuffer

Capture data from the memory buffer via a DSImageData object. To learn more about what the captured data can be, please see the Return Value section below.

  • Objective-C
  • Swift
  1. - (nullable DSCapturedResult *)captureFromBuffer:(DSImageData *)buffer
                                    templateName:(nonnull NSString*)templateName
                                           error:(NSError *_Nullable *_Nullable)error;
    
  2. func captureFromBuffer(_ buffer:DSImageData, templateName:String) throws -> CaptureResult
    

Parameters

buffer: A DSImageData object that contains image info.
templateName: Specify a template with a templateName for the data capturing.
error: An NSError pointer. If an error occurs, it will represent the error information.

Possible errors:

Error Code Value Description
EC_NULL_POINTER -10002 The ImageData object is null.
EC_TIMEOUT -10026 The processing timeout. If not all the tasks are timeout, you will still receive the results of the processed tasks.
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.
EC_MULTI_PAGES_NOT_SUPPORTED -10066 The api does not support multi-page files. Please use FileFetcher instead.

Return Value

A DSCapturedResult object.

captureFromImage

Capture data from the given image. To learn more about what the captured data can be, please see the Return Value section below.

  • Objective-C
  • Swift
  1. - (nullable DSCapturedResult *)captureFromImage:(UIImage *)image
                                   templateName:(nonnull NSString*)templateName
                                          error:(NSError *_Nullable *_Nullable)error;
    
  2. func captureFromBuffer(_ image:UIImage, templateName:String) throws -> CaptureResult
    

Parameters

image: A UIImage object.
templateName: Specify a template with a templateName for the data capturing.
error: An NSError pointer. If an error occurs, it will represent the error information.

Possible errors:

Error Code Value Description
EC_TIMEOUT -10026 The processing timeout. If not all the tasks are timeout, you will still receive the results of the processed tasks.
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.
EC_MULTI_PAGES_NOT_SUPPORTED -10066 The api does not support multi-page files. Please use FileFetcher instead.

Return Value

A DSCapturedResult object.

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

version 2.0.10

  • Latest version
  • Version 2.x
    • Version 2.2.10
    • Version 2.0.21
    • Version 2.0.20
    • Version 2.0.10
    • Version 2.2.10
    • Version 2.0.21
    • Version 2.0.20
    • Version 2.0.10
  • Version 1.x
    • Version 1.2.1
    • Version 1.2.0
    • Version 1.1.0
    • Version 1.0.0
    • Version 1.0.4
    • Version 1.0.3
    • Version 1.0.2
    • Version 1.0.1
    • Version 1.0.0
    • Version 1.1.11
    • Version 1.1.9
    • Version 1.1.8
    • Version 1.1.7
    • Version 1.1.6
    • Version 1.1.5
    • Version 1.1.4
    • Version 1.1.3
    • Version 1.1.2
    • Version 1.1.1
    • Version 1.1.0
    • Version 1.0.0
    • Version 1.0.4
    • Version 1.0.3
    • Version 1.0.2
    • Version 1.0.1
    • Version 1.0.0
Change +
© 2003–2024 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support