Creating 1D Barcode using the Google Chart API /ZXING library

10,129

The API you're using is deprecated(https://developers.google.com/chart/infographics/). And as far as I see, Google does not offer a 1D barcode generator API.

I suggest you stop using this API and download a class which can generate barcodes. ZF example: http://framework.zend.com/manual/1.12/en/zend.barcode.creation.html

Share:
10,129
BiL
Author by

BiL

Updated on June 16, 2022

Comments

  • BiL
    BiL almost 2 years

    I am trying to create 1D barcodes using PHP.I have been able to create the 2 D Qr code using the google chart api like this:

     $size = $_REQUEST['size'];
    $string = preg_replace('/\s+/','',$_REQUEST['content']);
    $content       = $string;//$_REQUEST['content'];
    $correction    = strtoupper($_REQUEST['correction']);
    $encoding      = $_REQUEST['encoding'];
    
    //form google chart api link
    $rootUrl = "https://chart.googleapis.com/chart?cht=qr&chs=$size&chl=$content&choe=$encoding&chld=$correction";
    
    //print out the image
    echo '<img src="'.$rootUrl.'">';
    

    This code simply generates the QR code.But i need barcode.What will i need to change in parameters to display it as 1D barcode??? Please note I am using PHP language and decoding data using Zxing library.Please help.Thanks