BarcodeGenerator

BarcodeGenerator class

Module: aspose_barcode.generation.barcode_generator

BarcodeGenerator for backend barcode images generation. Supported symbologies: 1D: Codabar, Code11, Code128, Code39Standard, Code39Extended Code93Standard, Code93Extended, EAN13, EAN8, Interleaved2of5, MSI, Standard2of5, UPCA, UPCE, ISBN, GS1Code128, Postnet, Planet EAN14, SCC14, SSCC18, ITF14, SingaporePost … 2D: Aztec, DataMatrix, PDf417, QR code … This sample shows how to create and save a barcode image.

Constructors

NameDescription
initBarcodeGenerator constructor.

Methods

NameReturn TypeStaticDescription
strstrNo
code_textstrNoText to be encoded.
export_to_xmlboolNoExports BarCode properties to the xml-stream specified.
generate_barcode_imageImageNoGenerate the barcode image under current settings. This sample shows how to create and save a barcode image.
import_from_xmlBarcodeGeneratorNoImports BarCode properties from the xml-file specified and creates BarcodeGenerator instance.
parametersBaseGenerationParametersNoGeneration parameters.
saveNoneNoSave barcode image to specific file in specific format.
set_code_textNoneNo

Properties

NameTypeDescription
barcode_typeEncodeTypesBarcode symbology type.

BarcodeGenerator Constructor

__init__(self, encode_type, Optional[str] code_text) -> def

BarcodeGenerator constructor.

ParameterTypeDescription
encode_type``
code_textOptional[str]

BarcodeGenerator.str

__str__(self) -> str

Return Type: str

BarcodeGenerator.code_text

code_text(self) -> str

Text to be encoded.

Return Type: str

BarcodeGenerator.export_to_xml

export_to_xml(self, str file_path) -> bool

Exports BarCode properties to the xml-stream specified.

ParameterTypeDescription
file_pathstrThe path to the file where the XML will be saved.

Return Type: bool — Whether the export completed successfully. Returns True in case of success; False Otherwise.

BarcodeGenerator.generate_barcode_image

generate_barcode_image(self) -> Image

Generate the barcode image under current settings. This sample shows how to create and save a barcode image.

Return Type: Image

BarcodeGenerator.import_from_xml

import_from_xml(self, cls, str resource) -> BarcodeGenerator

Imports BarCode properties from the xml-file specified and creates BarcodeGenerator instance.

ParameterTypeDescription
cls``
resourcestr

Return Type: BarcodeGenerator — instance

BarcodeGenerator.parameters

parameters(self) -> BaseGenerationParameters

Generation parameters.

Return Type: BaseGenerationParameters — BaseGenerationParameters

BarcodeGenerator.save

save(self, str imagePath, BarCodeImageFormat imageFormat)

Save barcode image to specific file in specific format.

ParameterTypeDescription
imagePathstrPath to save to.
imageFormatBarCodeImageFormatOptional format override. If omitted, the format to use is determined from the filename extension. If a file object was used instead of a filename, this parameter should always be used. generator = BarcodeGenerator(EncodeTypes.CODE_128, “123ABCDEFG”) generator.save(image_path_to_save3, BarCodeImageFormat.PNG)

BarcodeGenerator.set_code_text

set_code_text(self, Union[str, bytes] code_text, Optional[str] encoding, Optional[bool] BoM)
ParameterTypeDescription
code_textUnion[str, bytes]
encodingOptional[str]
BoMOptional[bool]

BarcodeGenerator.barcode_type

Type: EncodeTypes

Barcode symbology type.

Barcode symbology type.

ParameterTypeDescription
valueEncodeTypes