Пример #1
0
require admin_ROOT . 'public/barcode/Font.php';
require admin_ROOT . 'public/barcode/code128.barcode.php';
$fontname = admin_ROOT . 'public/fonts/en/FetteSteinschrif.ttf';
$text = $fun->accept('text', 'R');
$o = $fun->accept('o', 'R');
$o = empty($o) ? 1 : $o;
$t = $fun->accept('codeheight', 'R');
$t = empty($t) ? 35 : $t;
$r = $fun->accept('codesize', 'R');
$r = empty($r) ? 1 : $r;
$f1 = $fun->accept('f1', 'R');
$f1 = empty($f1) ? $fontname : $f1;
$f2 = $fun->accept('fontsize', 'R');
$f2 = empty($f2) ? 9 : $f2;
$a2 = $fun->accept('a2', 'R');
$a2 = empty($a2) ? 'B' : $a2;
$font = new BCGFont($f1, $f2);
$color_black = new BCGColor(0, 0, 0);
$color_white = new BCGColor(255, 255, 255);
$code_generated = new BCGcode128();
$code_generated->setStart($a2);
$code_generated->setThickness($t);
$code_generated->setScale($r);
$code_generated->setBackgroundColor($color_white);
$code_generated->setForegroundColor($color_black);
$code_generated->setFont($font);
$code_generated->parse($text);
$drawing = new BCGDrawing('', $color_white);
$drawing->setBarcode($code_generated);
$drawing->draw();
$drawing->finish(intval($o));
Пример #2
0
require_once $ruta . '/extensions/barcodegen/class/BCGFontFile.php';
require_once $ruta . '/extensions/barcodegen/class/BCGColor.php';
require_once $ruta . '/extensions/barcodegen/class/BCGDrawing.php';
require_once $ruta . '/extensions/barcodegen/class/BCGcode128.barcode.php';
// Loading Font
$font = new BCGFontFile($ruta . '/extensions/barcodegen/font/Arial.ttf', 8);
// The arguments are R, G, B for color.
$color_black = new BCGColor(0, 0, 0);
$color_white = new BCGColor(255, 255, 255);
// Barcode Part
$code = new BCGcode128();
$code->setScale(2);
$code->setThickness(30);
//tamaño en vertical pixel
$code->setForegroundColor($color_black);
$code->setBackgroundColor($color_white);
$code->setFont($font);
$code->setStart(NULL);
$code->setTilde(true);
$code->parse($cabFact['ClaveAcceso']);
$code->clearLabels();
//Elmina el TItulo de la LIbreria
// Drawing Part
//$drawing = new BCGDrawing(Yii::app()->theme->baseUrl.'/images/plantilla/filename.png', $color_white);
$drawing = new BCGDrawing('', $color_white);
$drawing->setBarcode($code);
$drawing->draw();
$drawing->setFilename(Yii::app()->params['seaBarra'] . $cabFact['IdentificacionComprador'] . '.png');
header('Content-Type: image/png');
//header('Content-Type: text/html; charset=utf-8');
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);