‚Äč

Cloud OCR SDK Documentation

processBarcodeField Method

The method allows you to extract the value of a barcode on an image. The method loads the image, creates a processing task for the image with the specified parameters, and passes the task for processing.

[POST] http(s)://cloud.ocrsdk.com/processBarcodeField

The image file is transmitted in the request body. See the list of supported input formats.

barcodeRecognition profile is used for processing.

The result of recognition is returned in XML format. Binary data is returned in Base64 encoding.

See How to Recognize Barcodes to know another way of barcode recognition.

For details on task cost please see billing terms.

Parameters

ParameterIs requiredDefault valueDescription
region No "-1,-1,-1,-1" Specifies the region of the text field on the image. The coordinates of the region are measured in pixels relative to the left top corner of the image and are specified in the following order: left, top, right, bottom. By default, the region of the whole image is used.
barcodeType No "autodetect" Specifies the type of the barcode. This parameter may also contain several barcode types separated with commas, for example "code39,code93". The following values can be used:
  • autodetect
  • patch
  • code39
  • code93
  • code128
  • ucc128
  • interleaved25
  • industrial25
  • iata25
  • matrix25
  • ean8
  • ean13
  • codabar
  • upca
  • upce
  • postNet
  • aztec
  • dataMatrix
  • pdf417
  • qrCode

See the description of barcode types for details.

containsBinaryData No "false" This parameter makes sense only for PDF417 and Aztec barcodes, which encode some binary data. If this parameter is set to true, the binary data encoded in a barcode are saved as a sequence of hexadecimal values for corresponding bytes.
description No "" Contains the description of the processing task. Must contain no more that 255 characters.
pdfPassword No "" Contains a password for accessing password-protected images in PDF format.

Status codes and response format

General status codes and response format of the method are described in HTTP Status Codes and Response Formats.

The following status codes can be returned when this method is called:

CodeDescription
200 Successful method call.
450 Incorrect parameters have been passed. One of the following errors occurred:
  • Image file has not been specified.
  • Incorrect region of the field has been specified.
  • Incorrect barcode type has been specified.
  • Task description length exceeds 255 characters.
  • Incorrect password for accessing password-protected image file has been specified.
  • Exceeded quota to add images. This error is returned if the number of images you have uploaded exceeds the number of images you can process with the credits available on your account plus some threshold. You can resolve this issue by topping up your account or by removing the tasks which have been submitted but have not been processed.
550 An internal program error occurred while processing the image.
551 An error occurred on the server side:
  • The format of the image file passed for processing is not supported.
  • The PDF file passed for processing has restrictions on creating raster images.

Output file format

The output XML file has the following format:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<document xmlns="@link" xmlns:xsi="@link" xsi:schemaLocation="@link" version="1.0">
	<field left=”0” top=”0” right=”199” bottom=”100” type=”barcode”>
		<value encoding=”Base64”>b783JHk48Njkdn27849</value>
	</field>
</document>