Search code examples
phpbarcodecode128

tc lib barcode include letters


I am using the tc-lib-barcode library to create a barcode. Creating it is not a problem but I want the letters of the barcode on the underside of it. How would I go on doing this?

$barcode = new Barcode();

$bObj = $barcode->getBarcodeObj(
    'C128',
    'testBarcode',
    1030,
    400
)->setBackgroundColor('white');

Solution

  • Using Intervention Image I just plopped a text image under the barcode:

    $template->text($barcodeText, $barcodeX, $barcodeY + $barcodeHeight + $barcodeFontSize, function ($font) use ($barcodeFontSize) {
        $font->file(__DIR__ . '/cour.ttf');
        $font->size($barcodeFontSize);
    });