Constructor
new BarcodeGenerator(encodeType, codeText)
BarcodeGenerator constructor.
Parameters:
Name | Type | Description |
---|---|---|
encodeType |
Barcode symbology type. Use EncodeTypes class to setup a symbology | |
codeText |
Text to be encoded. |
- Source:
Throws:
BarcodeException
Methods
exportToXml(filePath)
Exports BarCode properties to the xml file specified
Parameters:
Name | Type | Description |
---|---|---|
filePath |
The xml file |
Returns:
Type | Description |
---|---|
Whether or not export completed successfully. Returns True in case of success; False Otherwise |
- Source:
Throws:
IOException
generateBarCodeImage(format) → {String}
Generate the barcode image under current settings.
This sample shows how to create and save a barcode image.
Parameters:
Name | Type | Description |
---|---|---|
format |
BarCodeImageFormat | BarCodeImageFormat value (PNG, BMP, JPEG, GIF) |
Returns:
Type | Description |
---|---|
String | base64 representation of image. |
- Source:
Example
let generator = new BarCodeGenerator(EncodeTypes.CODE_128);
let image = generator.generateBarCodeImage(BarCodeImageFormat.GIF);
getBarcodeType()
Barcode symbology type.
- Source:
getCodeText()
Text to be encoded.
- Source:
getParameters()
Generation parameters.
Returns:
Type | Description |
---|---|
BaseGenerationParameters |
- Source:
save(filePath, format)
Save barcode image to specific file in specific format.
Parameters:
Name | Type | Description |
---|---|---|
filePath |
String | Path to save to. |
format |
BarCodeImageFormat | BarCodeImageFormat value (PNG, BMP, JPEG, GIF) |
- Source:
Example
let generator = new BarCodeGenerator(EncodeTypes.CODE_128);
generator.save("file path", BarCodeImageFormat.GIF);
setBarcodeType()
Barcode symbology type.
- Source:
setCodeText(codeText, encoding)
Encodes codetext with byte order mark (BOM) using specified encoding.
Parameters:
Name | Type | Description |
---|---|---|
codeText |
CodeText string | Bytes of codetext | |
encoding |
Applied encoding |
- Source:
(static) importFromXml(filePath)
Imports BarCode properties from the xml-file specified and creates BarcodeGenerator instance.
Parameters:
Name | Type | Description |
---|---|---|
filePath |
The name of the file |
Returns:
Type | Description |
---|---|
BarcodeGenerator instance |
- Source: