Generate an SSCC-18/UCC18 Barcode in PHP

July 17th, 2019





Using Picqer’s PHP Barcode Generator library, it’s possible to programmatically generate barcodes in a number of formats.

While there isn’t an explicitly stated support for SSCC-18 style barcodes, it is possible to generate them using this library.

Below is an example of how I implemented it:

<?php
    require_once 'vendor/autoload.php';

    $number = 00002347350023848877;
    $generator = new Picqer\Barcode\BarcodeGeneratorHTML();
    $code = chr(241).$number;
?>
<!DOCTYPE html>
<html>
    <body>
        <?php 
            echo $generator->getBarcode($code, Picqer\Barcode\BarcodeGeneratorPNG::TYPE_CODE_128_C, 2, 60); 
         ?>
    </body>
</html>

View it on GitHub

  • Filed to:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *