Custom Design for Barcode control.
5 Dec 20189 minutes to read
The Barcode can be easily configured to the DOM element. you can create a Barcode with a highly customizable look and feel.
Syntax
ej-barcode
Example
//Create the barcode by setting the symbologyType and providing input URL to the text property. QR code is rendered by default.
<ej-barcode text="http://www.syncfusion.com" id="qrbarcode" xDimension="8">
</ej-barcode>
Members
barcodeToTextGapHeight number
Specifies the distance between the Barcode and text below it.
NOTE
This property is applicable only for one dimensional barcode.
Default Value:
- 10 pixels
Example
// Add the below code to set barcodeToTextGapHeight during initialization
<ej-barcode text="SYNCFUSION" id="code39" [barcodeToTextGapHeight]="50" symbologyType="code39">
</ej-barcode>
barHeight number
Specifies the height of bars in the Barcode. By modifying the barHeight, the entire Barcode height can be customized. Please refer to xDimension for two dimensional barcode height customization.
NOTE
This property is applicable only for one dimensional barcode.
Default Value:
- 150 pixels
Example
// Add the below code to set darkBarColor during initialization
<ej-barcode text="SYNCFUSION" id="barcode39" [barHeight]="50" symbologyType="code39">
</ej-barcode>
darkBarColor object
Specifies the dark bar color of the Barcode. One dimensional barcode contains a series of dark and light bars which are usually colored as black and white respectively.
NOTE
- For the Barcode should be properly detected by all scanners, choose the best possible contrast color.
2. This property is applicable only for one dimensional barcode.
Default Value:
- black
Example
// Add the below code to set darkBarColor during initialization.
<ej-barcode text="SYNCFUSION" id="barcode39" darkBarColor="blue" symbologyType="code39">
</ej-barcode>
displayText boolean
Specifies whether the text below the Barcode is visible or hidden.
NOTE
This property is applicable only for one dimensional barcode.
Default Value:
- true
Example
// Add the below code to hide displayText during initialization
<ej-barcode text="SYNCFUSION" id="barcode39" [displayText]="false" symbologyType="code39">
enabled boolean
Specifies whether the control is enabled.
Default Value:
- true
Example
// Add the below code to disable the Barcode during initialization.
<ej-barcode text="SYNCFUSION" id="barcode39" [enabled]="false" symbologyType="code39">
</ej-barcode>
encodeStartStopSymbol boolean
Specifies the start and stop encode symbol in the Barcode. In one dimensional barcodes, an additional character is added as start and stop delimiters. These symbols are optional and the unique of the symbol allows the reader to determine the direction of the Barcode being scanned.
NOTE
This property is applicable only for one dimensional barcode.
Default Value:
- true
Example
// Add the below code to remove encodeStartStopSymbol during initialization.
<ej-barcode text="SYNCFUSION" id="barcode39" [encodeStartStopSymbol]="false" symbologyType="code39">
</ej-barcode>
lightBarColor object
Specifies the light bar color of the Barcode. One dimensional barcode contains a series of dark and light bars which are usually colored as black and white respectively.
NOTE
- For the Barcode should be properly detected by all scanners, choose the best possible contrast color.
2. This property is applicable only for one dimensional barcode.
Default Value:
- white
Example
// Add the below code to set lightBarColor during initialization
<ej-barcode text="SYNCFUSION" id="barcode39" lightBarColor="blue" symbologyType="code39">
</ej-barcode>
narrowBarWidth number
Specifies the width of the narrow bars in the Barcode. The dark bars in the one dimensional barcode contains random narrow and wide bars based on the provided input which can be specified during initialization.
NOTE
This property is applicable only for one dimensional barcode.
Default Value:
- 1 pixel
Example
// Add the below code to set narrowBarWidth during initialization
<ej-barcode text="SYNCFUSION" id="barcode39" [narrowBarWidth]="5" symbologyType="code39"></ej-barcode>
symbologyType enum
Specifies the type of the Barcode. See SymbologyType
Name | Description |
---|---|
QRBarcode | Represents the QR code |
DataMatrix | Represents the Data Matrix barcode |
Code39 | Represents the Code 39 barcode |
Code39Extended | Represents the Code 39 Extended barcode |
Code11 | Represents the Code 11 barcode |
Codabar | Represents the Codabar barcode |
Code32 | Represents the Code 32 barcode |
Code93 | Represents the Code 93 barcode |
Code93Extended | Represents the Code 93 Extended barcode |
Code128A | Represents the Code 128 A barcode |
Code128B | Represents the Code 128 B barcode |
Code128C | Represents the Code 128 C barcode |
UPCBarcode | Represents the UPC barcode |
Default Value:
- symbologyType=”qrBarcode”
Example
<ej-barcode text="http://www.syncfusion.com" id="qrbarcode" symbologyType="qrbarcode" xDimension="8">
</ej-barcode>
text string
Specifies the text to be encoded in the Barcode.
Default Value:
- empty
Example
<ej-barcode text="http://www.syncfusion.com" id="qrbarcode" xDimension="8">
</ej-barcode>
textColor object
Specifies the color of the text/data at the bottom of the Barcode.
NOTE
This property is applicable only for one dimensional barcode.
Default Value:
- black
Example
// All the below code to set the textColor while initialization
<ej-barcode text="SYNCFUSION" id="barcode39" textColor="blue" symbologyType="code39">
</ej-barcode>
wideBarWidth number
Specifies the width of the wide bars in the Barcode. One dimensional barcode usually contains random narrow and wide bars based on the provided which can be customized during initialization.
NOTE
This property is applicable only for one dimensional barcode.
Default Value:
- 3 pixels
Example
// Add the below code to set wideBarWidth during initialization.
<ej-barcode text="SYNCFUSION" id="barcode39" [wideBarWidth]="10" symbologyType="code39">
</ej-barcode>
xDimension number
Specifies the width of the narrowest element(bar or space) in a Barcode. The greater the x dimension, the more easily a barcode reader will scan.
NOTE
This property is applicable only for two dimensional barcode.
Default Value:
- 4 pixels
Example
// Add the below code to set xDimension during initialization.
<ej-barcode text="http://www.syncfusion.com" id="qrbarcode" xDimension="8">
</ej-barcode>