‪Aspose.Barcode for PHP via Java  22.4
‪Aspose.Barcode for PHP via Java Generation and Recognition API docs
BarcodeGenerator Class Reference

Inherits BaseJavaClass.

Public Member Functions

 __construct (?int $encodeType, ?string $codeText)
 
 getParameters ()
 
 getBarcodeType ()
 
 setBarcodeType (int $value)
 
 generateBarCodeImage (int $format)
 
 save (string $filePath, int $format)
 
 getCodeText ()
 
 setCodeText (string $value)
 
 exportToXml ($filePath)
 
 getJavaClass ()
 
 getJavaClassName ()
 
 isNull ()
 
 printJavaClassName ()
 

Static Public Member Functions

static construct ($javaClass)
 
static importFromXml ($resource)
 

Protected Member Functions

 init ()
 
 setJavaClass ($javaClass)
 

Detailed Description

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.

$encode_type = EncodeTypes::CODE_128;
$generator = new BarcodeGenerator($encode_type);
$generator->setCodeText("123ABC");

Constructor & Destructor Documentation

◆ __construct()

BarcodeGenerator::__construct ( ?int  $encodeType,
?string  $codeText 
)

BarcodeGenerator constructor.

Parameters
int | null$encodeType‪Barcode symbology type. Use EncodeTypes class to setup a symbology
string | null$codeText‪Text to be encoded. Should be encoded in UTF-8 encoding
$barcodeGenerator = new BarcodeGenerator(EncodeTypes::EAN_14, "332211");
Exceptions
BarcodeException

Member Function Documentation

◆ construct()

static BarcodeGenerator::construct (   $javaClass)
static

◆ exportToXml()

BarcodeGenerator::exportToXml (   $filePath)

Exports BarCode properties to the xml-stream specified

Parameters
$filePath‪path to xml file
Returns
‪bool Whether or not export completed successfully. Returns True in case of success; False Otherwise

◆ generateBarCodeImage()

BarcodeGenerator::generateBarCodeImage ( int  $format)

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

Parameters
int$format‪value of BarCodeImageFormat (PNG, BMP, JPEG, GIF, EMF)
Returns
‪string base64 representation of image.
$generator = new BarCodeGenerator(EncodeTypes::CODE_128);
$image = $generator->generateBarCodeImage(BarCodeImageFormat::PNG);
Exceptions
BarcodeException

◆ getBarcodeType()

BarcodeGenerator::getBarcodeType ( )

Barcode symbology type.

◆ getCodeText()

BarcodeGenerator::getCodeText ( )

Text to be encoded.

◆ getJavaClass()

BaseJavaClass::getJavaClass ( )
inherited

◆ getJavaClassName()

BaseJavaClass::getJavaClassName ( )
inherited

◆ getParameters()

BarcodeGenerator::getParameters ( )

Generation parameters.

Returns
BaseGenerationParameters

◆ importFromXml()

static BarcodeGenerator::importFromXml (   $resource)
static

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

Parameters
$resource‪path to xml file or http resource
Returns
BarcodeGenerator instance

◆ init()

BarcodeGenerator::init ( )
protected

Reimplemented from BaseJavaClass.

◆ isNull()

BaseJavaClass::isNull ( )
inherited

◆ printJavaClassName()

BaseJavaClass::printJavaClassName ( )
inherited

◆ save()

BarcodeGenerator::save ( string  $filePath,
int  $format 
)

Save barcode image to specific file in specific format.

Parameters
string$filePath‪Path to save to.
int$format‪value of BarCodeImageFormat (PNG, BMP, JPEG, GIF, EMF)
$generator = new BarCodeGenerator(EncodeTypes::CODE_128);
$generator->save(file_path, BarCodeImageFormat::PNG);
Exceptions
BarcodeException

◆ setBarcodeType()

BarcodeGenerator::setBarcodeType ( int  $value)

Barcode symbology type.

◆ setCodeText()

BarcodeGenerator::setCodeText ( string  $value)

Text to be encoded.

◆ setJavaClass()

BaseJavaClass::setJavaClass (   $javaClass)
protectedinherited