Aspose.Barcode for PHP via Java  21.3
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 (string $format_name)
 
 save (string $filePath, string $format_name)
 
 getCodeText ()
 
 setCodeText (string $value)
 

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()

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

BarcodeGenerator constructor.

Parameters
argscan take following combinations of arguments: 1) Barcode symbology type. Use EncodeTypes class to setup a symbology 2) type EncodeTypes, Text to be encoded.
$barcodeGenerator = new BarcodeGenerator(EncodeTypes::EAN_14, "332211");
Exceptions
BarcodeException

Member Function Documentation

◆ generateBarCodeImage()

generateBarCodeImage ( string  $format_name)

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

Parameters
$format_nameimage format name("PNG", "BMP", "JPEG", "GIF", "TIFF")

$generator = new BarCodeGenerator(EncodeTypes::CODE_128); $image = $generator->generateBarCodeImage(null);// if value = null, default image format PNG

Returns
base64 representaton of image.

◆ getBarcodeType()

getBarcodeType ( )

Barcode symbology type.

◆ getCodeText()

getCodeText ( )

Text to be encoded.

◆ getParameters()

getParameters ( )

Generation parameters.

Returns
BaseGenerationParameters

◆ save()

save ( string  $filePath,
string  $format_name 
)

Save barcode image to specific file in specific format.

Parameters
$filePathPath to save to.
$format_nameimage format name("PNG", "BMP", "JPEG", "GIF", "TIFF")

$generator = new BarCodeGenerator(EncodeTypes::CODE_128); $generator->save("file path", null);// if value = null, default image format PNG

◆ setBarcodeType()

setBarcodeType ( int  $value)

Barcode symbology type.

◆ setCodeText()

setCodeText ( string  $value)

Text to be encoded.