public static function run($dataDir = null) { # Instantiate barcode object $bb = new BarCodeBuilder(); # Set up code text (data to be encoded) $bb->setCodeText("1234567"); # Set the symbology type to Code128 $symbology = new Symbology(); $bb->setSymbologyType($symbology->Code128); # Save the image to file $bb->save($dataDir . "barcode.jpg"); # Set the x-dimension for the bars of the barcode $bb->setxDimension(0.5); # Save the image to file $bb->save($dataDir . "barcodeXDimensionChanged.jpg"); # Instantiate barcode object $bb1 = new BarCodeBuilder(); # Set the code text of the barcode $bb1->setCodeText("12345678"); # Set the symbology type to code128 $bb1->setSymbologyType($symbology->Pdf417); # Set the x-dimension for the bars of the barcode $bb1->setxDimension(0.5); # Save the image to file $bb1->save($dataDir . "barcodeYDimensionChanged.jpg"); # Display Status. print "BarCodes with different dimensions have been created successfully." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate barcode object $builder = new BarCodeBuilder(); $symbology = new Symbology(); $builder->setSymbologyType($symbology->Pdf417); # Width of each module $builder->setxDimension(0.6); # Height of each module $builder->setyDimension(1.2); $builder->setCodeText("this is some test code text. \n Second line \n third line."); # Save the image to your system and set its image format to Jpeg $builder->save($dataDir . "Creating2DBarcode.jpg"); # Display Status print "Created 2D Barcode Successfully." . PHP_EOL; }
public static function set_codetext($dataDir = null) { # Instantiate barcode object $bb = new BarCodeBuilder(); # Set the code text for the barcode $bb->setCodeText("Aspose-123"); # Set the symbology type to Code128 $symbology = new Symbology(); $bb->setSymbologyType($symbology->Code128); # Set the width of the bars to 0.5 millimeter $bb->setxDimension(0.5); # save the barcode image to file $bb->save($dataDir . "codetext.out.jpg"); # Print message print "Barcode image generated successfully." . PHP_EOL; }