Implementation

This section only covers working with Barcode Scanner in the Catalyst console. Refer to the SDK and API documentation sections for implementing Barcode Scanner in your application’s code.

As mentioned earlier, you can access the code templates that will enable you to integrate Barcode Scanner in your Catalyst application from the console, and also test the feature by uploading images with barcodes and obtaining the decoded content.

Access Barcode Scanner

To access Barcode Scanner in your Catalyst console:

  1. Navigate to Zia Services under Discover, then click Access Now on the Barcode Scanner window.
    catalyst_barcode_zia_page
  2. Click Try a Demo in the Barcode Scanner feature page.
    catalyst_barcode_index_page
    This will open the Barcode Scanner feature.
    catalyst_barcode_test_page

Test Barcode Scanner in the Catalyst Console

You can test Barcode Scanner by either selecting a sample image from Catalyst or by uploading your own image.

To scan a sample image with a barcode and decode its content:

  1. Click Select a Sample Image in the box.
    catalyst_barcode_sample
  2. Select an image from the samples provided.
    catalyst_barcode_select_sample
    Barcode Scanner will scan the barcode and display its content under Result.

    You can also click View Response to do so in the JSON format.
    catalyst_barcode_sample_json

To upload your own image with a barcode and decode its content:

  1. Click Upload under the Result section.
    catalyst_barcode_upload
    If you’re opening Barcode Scanner after you have closed it, click Browse Files in this box.
    catalyst_barcode_browse
  2. Upload a file from your local system.
Notes:
* The file must be in ._jpg_/._jpeg_ or ._png_ format. The file size must not exceed 10 MB. The resolution of the image must not exceed 36000000 pixels. * You will not be able to specify the barcode type as an input while testing it in the Catalyst console, as it is detected automatically. If you know the barcode type, you can specify it in the API request that you send from your Catalyst application.
The console will scan the barcode and display its content.
catalyst_barcode_qr_scanned
You can copy the content using the copy icon for easier access, or check the JSON response by clicking View Response.
catalyst_barcode_qr_json

Access Code Templates for Barcode Scanner

You can implement Barcode Scanner in your Catalyst application using the code templates provided by Catalyst for Java and Node.js platforms.

You can access them from the section below the test window. Click either the Java SDK or NodeJS SDK tab, and copy the code using the copy icon. You can paste this code in your web or Android application’s code wherever you require.

catalyst_barcode_java

In Java, you can process the input file as a new File and select the format of the barcode using the ZCBarcodeOptions module. If you want Zia to scan the image for all formats, you can use ZCBarcodeFormat.ALL. If you are aware of the format, you can enter it as ZCBarcodeFormat.ean13, for example. Refer to the API documentation for the keys of all supported formats.

catalyst_barcode_node

The Node.js code processes the barcode image as the object barcodePromise. You can provide the image file name and the format in a similar way here.