# Barcode Scan

{% hint style="info" %}

<pre data-overflow="wrap"><code>You'll need to import the javascript file in your website before starting from this <a data-footnote-ref href="#user-content-fn-1">link</a>.
</code></pre>

{% endhint %}

{% tabs %}
{% tab title="Plain Javascript" %}

```
const { Format, BarcodeScan } = WTN.Barcode;
BarcodeScan({
  format: Format.QR_CODE, // optional
  onBarcodeSearch: (value) => {
    console.log(value);
  },
});
```

{% endtab %}

{% tab title="ES5+" %}

```
import { Format, BarcodeScan } from "webtonative/barcode"
BarcodeScan({
  format: Format.QR_CODE, // optional
  onBarcodeSearch: (value) => {
    console.log(value);
  },
});
```

{% endtab %}
{% endtabs %}

**BarcodeScan**: Call BarcodeScan to scan barcode from native apps.

* **format**: This is optional parameter is you don't pass it, it will try to scan all the available barcode formats listed below.
* **onBarcodeSearch**: This callback function will be called when it successfully scans barcode.

## Format Types

Following is the list of all the supported format types

1. Format.ALL\_FORMATS
2. Format.QR\_CODE
3. Format.UNKNOWN
4. Format.CODE\_128
5. Format.CODE\_39
6. Format.CODE\_93
7. Format.CODABAR
8. Format.EAN\_13
9. Format.EAN\_8
10. Format.ITF
11. Format.UPC\_A
12. Format.PDF417
13. Format.AZTEC

[^1]: <https://docs.webtonative.com/javascript-apis/getting-started>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webtonative.com/javascript-apis/barcode-scan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
