Aspose.Barcode for PHP via Java Generation and Recognition API docs

Inherits BaseJavaClass.

Public Member Functions

 __construct (?int $encodeType, ?string $codeText)
 
 getParameters ()
 
 getBarcodeType ()
 
 setBarcodeType (int $value)
 
 generateBarCodeGDImage ()
 
 generateBarCodeImage (int $format)
 
 save (string $filePath, int $format)
 
 getCodeText ()
 
 setCodeText ($value, ?string $encoding)
 
 exportToXml ($filePath)
 
- Public Member Functions inherited from BaseJavaClass
 __construct ($javaClass)
 
 getJavaClass ()
 
 getJavaClassName ()
 
 isNull ()
 
 printJavaClassName ()
 

Static Public Member Functions

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

Protected Member Functions

 init ()
 
- Protected Member Functions inherited from BaseJavaClass
 setJavaClass ($javaClass)
 

Private Attributes

 $parameters
 
const JAVA_CLASS_NAME = "com.aspose.mw.barcode.generation.MwBarcodeGenerator"
 

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$encodeTypeBarcode symbology type. Use EncodeTypes class to setup a symbology
string | null$codeTextText 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
$filePathpath to xml file
Returns
bool Whether or not export completed successfully. Returns True in case of success; False Otherwise

◆ generateBarCodeGDImage()

BarcodeGenerator::generateBarCodeGDImage ( )

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

Returns
string GD representation of image.
$generator = new BarCodeGenerator(EncodeTypes::CODE_128);
$image = $generator->generateBarCodeGDImage();
Exceptions
BarcodeException

◆ 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$formatvalue 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.

◆ 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
$resourcepath to xml file or http resource
Returns
BarcodeGenerator instance

◆ init()

BarcodeGenerator::init ( )
protected

Reimplemented from BaseJavaClass.

◆ save()

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

Save barcode image to specific file in specific format.

Parameters
string$filePathPath to save to.
int$formatvalue 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 (   $value,
?string  $encoding 
)

Encodes codetext with byte order mark (BOM) using specified encoding.

Parameters
string|arraycodeText CodeText string | Bytes of codetext
intencoding Applied encoding

Member Data Documentation

◆ $parameters

BarcodeGenerator::$parameters
private

◆ JAVA_CLASS_NAME

const BarcodeGenerator::JAVA_CLASS_NAME = "com.aspose.mw.barcode.generation.MwBarcodeGenerator"
private