public static function run($dataDir = null) { # Instantiate barcode object $bb = new BarCodeBuilder(); $color = new Color(); # Set the background color of the barcode $bb->setBackColor($color->YELLOW); # Set the foreground color of the barcode $bb->setForeColor($color->BLUE); # Set border's color $bb->setBorderColor($color->RED); # Set the code text's color $bb->setCodeTextColor($color->RED); # Caption's color $bb->getCaptionAbove()->setForeColor($color->darkGray); $bb->getCaptionBelow()->setForeColor($color->CYAN); $bb->save($dataDir . "color.jpg"); # Display Status. print "Applied color to barcode image, please check the output file." . PHP_EOL; }
public static function run($dataDir = null) { # Instantiate barcode object $bb = new BarCodeBuilder(); $margins = new MarginsF(); # 6 milimeter space from left, right, top and bottom side of border $margins->setLeft(2); $margins->setRight(2); $margins->setTop(2); $margins->setBottom(2); # Set border's width to be 0.5 milimeter $bb->setBorderWidth(0.5); # Border will be visible $bb->setBorderVisible(true); # Set the border's color to red $color = new Color(); $bb->setBorderColor($color->RED); # Set margins $bb->setMargins($margins); $bb->save($dataDir . "border.jpg"); # Display Status. print "Set border margins, please check the output file." . PHP_EOL; }