Démonstration - UPC-E
<?php
use BarcodeBakery\Common\BCGFontFile;
use BarcodeBakery\Common\BCGColor;
use BarcodeBakery\Common\BCGDrawing;
use BarcodeBakery\Barcode\BCGupce;
$font = new BCGFontFile(__DIR__ . '/font/Arial.ttf', 18);
$colorBlack = new BCGColor(0, 0, 0);
$colorWhite = new BCGColor(255, 255, 255);
// Barcode Part
$code = new BCGupce();
$code->setScale(2);
$code->setThickness(30);
$code->setForegroundColor($colorBlack);
$code->setBackgroundColor($colorWhite);
$code->setFont($font);
$code->parse('548154');
// Drawing Part
$drawing = new BCGDrawing($code, $colorWhite);
header('Content-Type: image/png');
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
?>