PHP code example of komgrip / barcode
1. Go to this page and download the library: Download komgrip/barcode library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
komgrip / barcode example snippets
use CodeItNow\BarcodeBundle\Utils\QrCode;
$qrCode = new QrCode();
$qrCode
->setText('QR code by codeitnow.in')
->setSize(300)
->setPadding(10)
->setErrorCorrection('high')
->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))
->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))
->setLabel('Scan Qr Code')
->setLabelFontSize(16)
->setImageType(QrCode::IMAGE_TYPE_PNG)
;
echo '<img src="data:'.$qrCode->getContentType().';base64,'.$qrCode->generate().'" />';
use CodeItNow\BarcodeBundle\Utils\BarcodeGenerator;
$barcode = new BarcodeGenerator();
$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code128);
$barcode->setScale(2);
$barcode->setThickness(25);
$barcode->setFontSize(10);
$code = $barcode->generate();
echo '<img src="data:image/png;base64,'.$code.'" />';
$barcode->setText("A0123456789C");
$barcode->setType(BarcodeGenerator::Codabar);
$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code11);
$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code39);
$barcode->setText("0123456789");
$barcode->setType(BarcodeGenerator::Code39Extended);
$barcode->setText("00123456789012345675");
$barcode->setType(BarcodeGenerator::Ean128);
$barcode->setText("00123456789012345675");
$barcode->setType(BarcodeGenerator::Gs1128);
$barcode->setText("4157707266014651802001012603068039000000006377069620171215");
$barcode->setType(BarcodeGenerator::Gs1128);
$barcode->setNoLengthLimit(true);
$barcode->setAllowsUnknownIdentifier(true);
$barcode->setText("00123456789012345675");
$barcode->setType(BarcodeGenerator::I25);
$barcode->setText("0012345678901");
$barcode->setType(BarcodeGenerator::Isbn);
$barcode->setText("0012345678901");
$barcode->setType(BarcodeGenerator::Msi);
$barcode->setText("01234567890");
$barcode->setType(BarcodeGenerator::Postnet);
$barcode->setText("012345678901");
$barcode->setType(BarcodeGenerator::S25);
$barcode->setText("012345678901");
$barcode->setType(BarcodeGenerator::Upca);
$barcode->setText("012345");
$barcode->setType(BarcodeGenerator::Upce);