# generateBarcode

## Description

Creates a machine-readable code in the form of numbers and a pattern of parallel lines of varying widths.

## Input / Parameter

| Name        | Description                   | Input Type  | Default | Options | Required |
| ----------- | ----------------------------- | ----------- | ------- | ------- | -------- |
| type        | The type of barcode.          | String/Text | CODE128 | -       | No       |
| fontSize    | The font size of the barcode. | Number      | 20      | -       | No       |
| height      | The height of the barcode.    | Number      | 100     | -       | No       |
| width       | The width of the barcode.     | Number      | 2       | -       | No       |
| margin      | The margin of the barcode.    | Number      | 10      | -       | No       |
| value       | The value of the barcode.     | String/Text | -       | -       | Yes      |
| displayText | To display text or not.       | Boolean     | true    | -       | No       |
| text        | The text to display.          | String/Text | -       | -       | No       |
| bold        | Bolds the text.               | String/Text | -       | -       | No       |
| italic      | Italicizes the text.          | String/Text | -       | -       | No       |
| textAlign   | To align text or not.         | String/Text | center  | -       | No       |

## Output

| Description                               | Output Type |
| ----------------------------------------- | ----------- |
| Returns the base64 barcode image pattern. | String/Text |

## Callback

N/A

## Video

Coming Soon.

## Example

The user wants to generate a barcode.

### Step

1. Call the function "setComponentValue" and set the value for component.\
   component: imgQR<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-1cbd1b2a9b591d9f507bf62fb9a12bc032bdf294%2FgenerateBarcode-step-1.png?alt=media)
2. Call the function "generateBarcode" and set the value for barcode.\
   height : 200\
   width : 200\
   value : aaa

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-39180719cefbef57bd52daaa7122ff3054c362b4%2FgenerateBarcode-step-2.png?alt=media)

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-298729c35fbdc3078701bd19e9314acfc5736e0e%2FgenerateBarcode-step-3.png?alt=media)
3. Add a console for display the response from console.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-d8c431ee8ca52620ff4f1b8fcc8179c30b75b43d%2FgenerateBarcode-step-4.png?alt=media)

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-97eaaa776f5bc749e2f42d509c53a8d2b0be25d3%2FgenerateBarcode-result-1.png?alt=media)

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-d65d969ad795ba9b95ab53bc76b5fc8f56df10d8%2FgenerateBarcode-result-2.png?alt=media)

## Links
