Created
April 22, 2015 01:05
-
-
Save anonymous/34d234a10a68e7e6936a to your computer and use it in GitHub Desktop.
Barcode Gen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('barcodegen.1d-php5.v5.2.1/class/BCGFontFile.php'); | |
require_once('barcodegen.1d-php5.v5.2.1/class/BCGColor.php'); | |
require_once('barcodegen.1d-php5.v5.2.1/class/BCGDrawing.php'); | |
require_once('barcodegen.1d-php5.v5.2.1/class/BCGcode39.barcode.php'); | |
$font = new BCGFontFile('./barcodegen.1d-php5.v5.2.1/font/Arial.ttf', 18); | |
$color_black = new BCGColor(0, 0, 0); | |
$color_white = new BCGColor(255, 255, 255); | |
// Barcode Part | |
$code = new BCGcode39(); | |
$code->setScale(2); | |
$code->setThickness(30); | |
$code->setForegroundColor($color_black); | |
$code->setBackgroundColor($color_white); | |
$code->setFont($font); | |
$code->setChecksum(false); | |
$code->parse('A123'); | |
// Drawing Part | |
$drawing = new BCGDrawing('', $color_white); | |
$drawing->setBarcode($code); | |
$drawing->draw(); | |
header('Content-Type: image/png'); | |
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment