Class

# Barcode

<div class="rst-class">

forsearch

</div>

Hardware

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Uses the device's camera to read any bar code types supported by the device.

You must call `StartScan<barcode.startscan>` to display the scanning interface and begin scanning for a <span class="title-ref">barcode</span>. Scanning continues until `StopScan<barcode.stopscan>` is called in code or the user closes the scanning dialog.

Once `StartScan<barcode.startscan>` is called, displaying the scanning interface does not block execution of code on the main thread. Use the `ScanCompleted<barcode.scancompleted>`, `ScanCancelled<barcode.scancancelled>`, and `ScanFailed<barcode.scanfailed>` events to respond to the result of the scan.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                             | Type                               | Read-Only | Shared |
|----------------------------------|------------------------------------|-----------|--------|
| `FullScreen<barcode.fullscreen>` | `Boolean</api/data_types/boolean>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                           | Parameters                                                                                                                                                                                                       | Returns                            | Shared |
|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `FromImage<barcode.fromimage>` | image As `Picture</api/graphics/picture>`                                                                                                                                                                        | `String()</api/data_types/string>` | ✓      |
| `Image<barcode.image>`         | value As `String</api/data_types/string>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, type As `Barcode.Types<barcode.types>` = `Barcode.Types.QR<barcode.types>` | `Picture</api/graphics/picture>`   | ✓      |
| `StartScan<barcode.startscan>` |                                                                                                                                                                                                                  |                                    |        |
| `StopScan<barcode.stopscan>`   |                                                                                                                                                                                                                  |                                    |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                   | Parameters                                | Returns |
|----------------------------------------|-------------------------------------------|---------|
| `ScanCancelled<barcode.scancancelled>` |                                           |         |
| `ScanCompleted<barcode.scancompleted>` | value As `String</api/data_types/string>` |         |
| `ScanFailed<barcode.scanfailed>`       |                                           |         |

## Enumerations

<div id="barcode.types">

<div class="rst-class">

forsearch

</div>

</div>

Barcode.Types

### Types

> The types of <span class="title-ref">barcodes</span> that can be read.
>
> | Name   |
> |--------|
> | QR     |
> | Bar128 |

## Property descriptions

<div id="barcode.fullscreen">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.FullScreen

**FullScreen** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>` the <span class="title-ref">barcode</span> scanner will appear full screen.
>
> This can be changed even while the <span class="title-ref">barcode</span> scanner is already displayed.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is only supported for iOS.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> For Web, please use the `WebBarcode</api/web/webbarcode>` control.
>
> </div>

## Method descriptions

<div id="barcode.fromimage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.FromImage

**FromImage**(image As `Picture</api/graphics/picture>`) As `String()</api/data_types/string>`

> Returns an array of the unique identifiers from all detected <span class="title-ref">barcodes</span> in the *image* provided.
>
> This method is `shared</api/language/shared>`.

<div id="barcode.image">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.Image

**Image**(value As `String</api/data_types/string>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, type As `Barcode.Types<barcode.types>` = `Barcode.Types.QR<barcode.types>`) As `Picture</api/graphics/picture>`

> Returns an image with the value encoded as the specified type of <span class="title-ref">barcode</span>.
>
> This method is `shared</api/language/shared>`.

<div id="barcode.startscan">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.StartScan

**StartScan**

> Opens the scanning user interface provided by the device and begins scanning for a <span class="title-ref">barcode</span>. The device will auto-detect the type of <span class="title-ref">barcode</span>. Scanning continues until `StopScan<barcode.stopscan>` is called in code or the user closes the scanning dialog.
>
> Displaying the scanning interface does not block execution of code on the main thread. Use the `ScanCompleted<barcode.scancompleted>`, `ScanCancelled<barcode.scancancelled>`, and `ScanFailed<barcode.scanfailed>` events to respond to the result of the scan.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> For macOS, this method requires macOS 10.15 or later.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> For Web, please use the `WebBarcode</api/web/webbarcode>` control.
>
> </div>

<div id="barcode.stopscan">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.StopScan

**StopScan**

> Stops the process of scanning <span class="title-ref">barcodes</span> and closes the scanning user interface on the device.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> For Web, please use the `WebBarcode</api/web/webbarcode>` control.
>
> </div>

## Event descriptions

<div id="barcode.scancancelled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.ScanCancelled

**ScanCancelled**

> The user canceled the scan.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> For Web, please use the `WebBarcode</api/web/webbarcode>` control.
>
> </div>

<div id="barcode.scancompleted">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.ScanCompleted

**ScanCompleted**(value As `String</api/data_types/string>`)

> A <span class="title-ref">barcode</span> was successfully scanned. The *value* is the unique identifier scanned.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> For Web, please use the `WebBarcode</api/web/webbarcode>` control.
>
> </div>

<div id="barcode.scanfailed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Barcode.ScanFailed

**ScanFailed**

> The scan was not able to complete.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> For Web, please use the `WebBarcode</api/web/webbarcode>` control.
>
> </div>

## Notes

For Android Play Store installs, the Play Store will download and install the <span class="title-ref">barcode</span> library if it was not already installed on the device. For non Play Store-installs, the OS will download the library after it is first used (if it is not already installed). Attempting to scan before the library is installed (which could take several minutes depending on how the OS prioritizes it) will result in the `ScanFailed<barcode.scanfailed>` event will be called until it completes.

On Linux, X11 is required. This class is not supported for Wayland.

### Supported <span class="title-ref">barcode</span> types

The following types of <span class="title-ref">barcodes</span> are supported:

| Type            | Description                                                                                                                                                                              |
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Aztec           | Two-dimensional <span class="title-ref">Barcodes</span> and has a characteristic square pattern in the middle. This Code is widely used by railway companies in their ticketing systems. |
| Code39          | Widely used in a variety of industries and is part of of many governmental specifications. It encodes a set of alphanumeric symbols.                                                     |
| Code93          | Encodes numerical input, as well as capital letters and some special characters. It used by Canada Post for additional delivery information.                                             |
| Code128         | Universal <span class="title-ref">barcode</span> with excellent data density. It is used, for example, in shipping and packaging.                                                        |
| Data Matrix     | Two-dimensional Code that may contain text, numbers or binary data. It is widely used for labeling small electronic components or in food production, but also on mail labels.           |
| EAN8            | Derived from the longer European Article Number (EAN-13) code. It was introduced for use on small packages where an EAN-13 <span class="title-ref">barcode</span> would be too large.    |
| EAN13           | Codes are widely used in retail across Europe. There are several versions of EAN encoding 2, 5, 7 or 12 digits.                                                                          |
| Interleaved2of5 | Developed on the basis of Industrial Code 2 of 5 and only encodes an even number of digits. It is used in warehousing and industrial applications.                                       |
| ITF14           | Also called SCC-14 is used to mark shipping containers. It is also placed on cartons and pallets and signifies the type of products transported.                                         |
| PDF417          | Suitable for storing large amounts of data due to its two-dimensional structure. It is widely used for labeling electronic equipment or hazardous materials, but also on personal IDs.   |
| QR              | Applications include product tracking, item identification, time tracking, document management, and general marketing.                                                                   |
| UPC-E           | Only has 8 digits and is used instead of UPC-A on smaller products. It is similarly used in retail and warehousing, especially in the USA and Canada.                                    |

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `WebBarcode</api/web/webbarcode>` class

</div>
