コード例 #1
0
ファイル: barcode.php プロジェクト: ekchanthorn/demo_loan
 function index()
 {
     $text = rawurldecode($this->input->get('text'));
     $barcode = rawurldecode($this->input->get('barcode'));
     $scale = $this->input->get('scale') ? $this->input->get('scale') : 1;
     $thickness = $this->input->get('thickness') ? $this->input->get('thickness') : 30;
     $font = new BCGFontFile(APPPATH . 'libraries/barcode/font/Arial.ttf', 10);
     $color_black = new BCGColor(0, 0, 0);
     $color_white = new BCGColor(255, 255, 255);
     // Barcode Part
     $code = new BCGcode128();
     $code->setScale($scale);
     $code->setThickness($thickness);
     $code->setForegroundColor($color_black);
     $code->setBackgroundColor($color_white);
     $code->setFont($font);
     $code->setLabel($text);
     $code->parse($barcode);
     // Drawing Part
     $drawing = new BCGDrawing('', $color_white);
     $drawing->setBarcode($code);
     $drawing->draw();
     header('Content-Type: image/png');
     $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
 }
コード例 #2
0
ファイル: CBarCode.php プロジェクト: bvillac/websea
 public function output($text, $scale = 1)
 {
     $font = new BCGFont(dirname(__FILE__) . '/class/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);
     $code = new BCGcode128();
     $code->setScale($scale);
     // Resolution
     $code->setThickness(25);
     // Thickness
     $code->setForegroundColor($color_black);
     // Color of bars
     $code->setBackgroundColor($color_white);
     // Color of spaces
     $code->setFont($font);
     // Font (or 0)
     $code->parse($text);
     //$code->setLabel('');
     /* Here is the list of the arguments
        1 - Filename (empty : display on screen)
        2 - Background color */
     $drawing = new BCGDrawing('', $color_white);
     $drawing->setBarcode($code);
     //$drawing->draw();
     return $drawing;
     // Header that says it is an image (remove it if you save the barcode to a file)
     //header('Content-Type: image/png');
     // Draw (or save) the image into PNG format.
     //$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
 }
コード例 #3
0
ファイル: barcode.php プロジェクト: OranTing/gdby_github_repo
 /**
  * 获取条形码服务
  * 用法:http://s.dachuwang.com/barcode/get?text=2015081923456&thickness=70&scale=1&source=F
  * @param string text 条码内容,必须
  * @param string source 条码类型,用于区分不同场景的扫码,必须
  * @param number thickness 条码高度(20-90),默认为50
  * @param number scale 条码大小(1-4), 默认为2
  * @author yuanxiaolin@dachuwang.com
  */
 public function get()
 {
     try {
         $this->load->model('DataModel', 'datamodel');
         $params = $this->datamodel->barcode_params();
         $colorFront = new BCGColor(0, 0, 0);
         $colorBack = new BCGColor(255, 255, 255);
         //$font = new BCGFontFile(BARCODE_DIR.'/font/Arial.ttf', 14);
         $code = new BCGcode128();
         $code->setScale($params['scale']);
         // 条码显示大小:1-4,默认为2
         $code->setThickness($params['thickness']);
         // 条码显示高度:20-90,默认50
         $code->setForegroundColor($colorFront);
         // 条码颜色为黑色
         $code->setBackgroundColor($colorBack);
         // 条码背景为白色
         //$code->setFont($font);
         $code->parse($params['text']);
         // 条码内容
         $drawing = new BCGDrawing('', $colorBack);
         $drawing->setBarcode($code);
         $drawing->draw();
         //header('Content-Type: image/png');
         $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
コード例 #4
0
 public function code128Action($text = null)
 {
     $text = $text ? $text : '000-000-000';
     if ($this->format !== 'png') {
         return $this->redirect("scan-code/code-128/{$text}.png", true);
     }
     $labelStyle = $this->form->labelStyle->getString();
     if (!in_array($labelStyle, ['normal', 'none'])) {
         $labelStyle = 'normal';
     }
     $fileName = md5($text . $labelStyle) . '.png';
     $path = "{$this->cachePath}/{$fileName}";
     if (file_exists($path) && time() - filemtime($path) < $this->recacheTime) {
         return file_get_contents($path);
     }
     $font = new \BCGFontFile(\Lvs\ROOT_PATH . '/fonts/Arial.ttf', 14);
     $black = new \BCGColor(0, 0, 0);
     $white = new \BCGColor(255, 255, 255);
     $ex = null;
     try {
         $code = new \BCGcode128();
         $code->setScale(3);
         $code->setThickness(30);
         $code->setForegroundColor($black);
         $code->setBackgroundColor($white);
         $code->setFont($font);
         if ($labelStyle === 'none') {
             $code->setLabel(null);
         }
         $code->parse($text);
     } catch (\Exception $e) {
         $ex = $e;
     }
     $img = new \BCGDrawing($path, $white);
     if ($ex) {
         $img->drawException($ex);
     } else {
         $img->setBarcode($code);
         $img->draw();
     }
     $img->finish(\BCGDrawing::IMG_FORMAT_PNG);
     if (!file_exists($path)) {
         $img->setFilename(null);
         $img->draw();
         $img->finish(\BCGDrawing::IMG_FORMAT_PNG);
         return '';
     }
     return file_get_contents($path);
 }
コード例 #5
0
ファイル: Barcodegen.class.php プロジェクト: h3len/Project
 public function create($text = '', $filename = '')
 {
     if (!$text) {
         return false;
     }
     $font = new BCGFontFile(CUR_CONF_PATH . 'lib/barcodegen/font/Arial.ttf', $this->font);
     $text = $text ? $text : 'NO INPUTS';
     $color_black = new BCGColor(0, 0, 0);
     $color_white = new BCGColor(255, 255, 255);
     $drawException = null;
     try {
         $code = new BCGcode128();
         $code->setScale(2);
         // Resolution
         $code->setThickness(60);
         // Thickness
         $code->setForegroundColor($color_black);
         // Color of bars
         $code->setBackgroundColor($color_white);
         // Color of spaces
         $code->setFont($font);
         // Font (or 0)
         $code->parse($text);
         // Text
     } catch (Exception $exception) {
         $drawException = $exception;
     }
     /* Here is the list of the arguments
     		1 - Filename (empty : display on screen)
     		2 - Background color */
     $drawing = new BCGDrawing($filename, $color_white);
     if ($drawException) {
         $drawing->drawException($drawException);
     } else {
         $drawing->setBarcode($code);
         $drawing->draw();
     }
     // Header that says it is an image (remove it if you save the barcode to a file)
     /*
     header('Content-Type: image/png');
     header('Content-Disposition: inline; filename="barcode.png"');
     */
     $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
     return true;
 }
コード例 #6
0
ファイル: barcode.php プロジェクト: marsa1985/kazabiz
 function generateBarcode()
 {
     require 'components/com_enmasse/helpers/barcodegen/class/BCGFont.php';
     require 'components/com_enmasse/helpers/barcodegen/class/BCGColor.php';
     require 'components/com_enmasse/helpers/barcodegen/class/BCGDrawing.php';
     include 'components/com_enmasse/helpers/barcodegen/class/BCGcode128.barcode.php';
     $num = $_GET['num'];
     // Loading Font
     $font = new BCGFont('components/com_enmasse/helpers/barcodegen/class/font/Arial.ttf', 13);
     // The arguments are R, G, B for color.
     $color_black = new BCGColor(0, 0, 0);
     $color_white = new BCGColor(255, 255, 255);
     $drawException = null;
     try {
         $code = new BCGcode128();
         //$code->setScale(1.5); // Resolution
         $code->setThickness(40);
         // Thickness
         $code->setForegroundColor($color_black);
         // Color of bars
         $code->setBackgroundColor($color_white);
         // Color of spaces
         $code->setFont($font);
         // Font (or 0)
         $code->parse($num);
         // Text
     } catch (Exception $exception) {
         $drawException = $exception;
     }
     /* Here is the list of the arguments
     	1 - Filename (empty : display on screen)
     	2 - Background color */
     $drawing = new BCGDrawing('', $color_white);
     if ($drawException) {
         $drawing->drawException($drawException);
     } else {
         $drawing->setBarcode($code);
         $drawing->draw();
     }
     // Header that says it is an image (remove it if you save the barcode to a file)
     header('Content-Type: image/png');
     // Draw (or save) the image into PNG format.
     $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
     die;
 }
コード例 #7
0
ファイル: barcode.php プロジェクト: qiuai/enterprise
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));
コード例 #8
0
ファイル: barcode.php プロジェクト: minorusal/administrador
 public function create($texto = '')
 {
     if ($texto) {
         // Variables
         $f_name = $this->font_name;
         $f_size = $this->font_size;
         $escala = $this->barcode_escala;
         $grosor = $this->barcode_grosor;
         $tipo = $this->barcode_img_tipo;
         // Cargar fuente
         $font = new BCGFontFile($f_name, $f_size);
         // Definción de colores
         $color_black = new BCGColor(0, 0, 0);
         $color_white = new BCGColor(255, 255, 255);
         $drawException = null;
         try {
             switch ($this->barcode_encode) {
                 case 'code39':
                     $code = new BCGcode39();
                     break;
                 case 'code93':
                     $code = new BCGcode93();
                     break;
                 case 'code128':
                     $code = new BCGcode128();
                     break;
                 case 'ean8':
                     $code = new BCGean8();
                     break;
                 case 'ean13':
                     $code = new BCGean13();
                     break;
                 default:
                     $code = new BCGcode128();
                     break;
             }
             // $code = new BCGcode128();
             $code->setScale($escala);
             // Resolucion
             $code->setThickness($grosor);
             // grosor
             $code->setForegroundColor($color_black);
             // Color de barras
             $code->setBackgroundColor($color_white);
             // Color de espacios
             $code->setFont($font);
             // Fuente (or 0)
             $code->parse($texto);
             // Texto
         } catch (Exception $exception) {
             $drawException = $exception;
         }
         /* Here is the list of the arguments
            1 - Filename (empty : display on screen)
            2 - Background color */
         $drawing = new BCGDrawing($this->archivo, $color_white);
         if ($drawException) {
             $drawing->drawException($drawException);
         } else {
             $drawing->setBarcode($code);
             $drawing->draw();
         }
         // Identificación de formato y Crear imagen al vuelo
         switch ($tipo) {
             case 'wbmp':
                 // $ext  = 'wbmp';
                 // $mime = 'image/vnd.wap.wbmp';
                 // header('Content-Type: '.$mime);
                 // header('Content-Disposition: inline; filename="barcode.'.$ext.'"');
                 $drawing->finish(BCGDrawing::IMG_FORMAT_WBMP);
                 break;
             case 'png':
                 // $ext  = 'png';
                 // $mime = 'image/png';
                 // header('Content-Type: '.$mime);
                 // header('Content-Disposition: inline; filename="barcode.'.$ext.'"');
                 $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
                 break;
             case 'gif':
                 // $ext  = 'gif';
                 // $mime = 'image/gif';
                 // header('Content-Type: '.$mime);
                 // header('Content-Disposition: inline; filename="barcode.'.$ext.'"');
                 $drawing->finish(BCGDrawing::IMG_FORMAT_GIF);
                 break;
             case 'jpg':
                 // $ext  = 'jpg';
                 // $mime = 'image/jpeg';
                 // header('Content-Type: '.$mime);
                 // header('Content-Disposition: inline; filename="barcode.'.$ext.'"');
                 $drawing->finish(BCGDrawing::IMG_FORMAT_JPEG);
                 break;
             default:
                 return false;
                 break;
         }
         return $this->archivo;
     } else {
         return false;
     }
 }
コード例 #9
0
ファイル: Shipment.php プロジェクト: rajarshc/Rooja
 protected function insertTrack(&$page, $shipment)
 {
     $tracks = array();
     if ($shipment) {
         $tracks = $shipment->getAllTracks();
     }
     if (count($tracks)) {
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         $font = $this->_setFontBold($page, 15);
         foreach ($tracks as $track) {
             $CarrierCode = $track->getCarrierCode();
             if ($CarrierCode != 'custom') {
                 $carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($CarrierCode);
                 $carrierTitle = $carrier->getConfigData('title');
             } else {
                 $carrierTitle = Mage::helper('sales')->__('Custom Value');
             }
             $truncatedTitle = strtoupper(substr($track->getTitle(), 0, 45) . (strlen($track->getTitle()) > 45 ? '...' : ''));
             $feed = $this->getAlignCenter($truncatedTitle, 20, 290, $font, 15);
             $page->drawText($truncatedTitle, $feed, 210, 'UTF-8');
             // Convert to barcode
             $drawException = null;
             try {
                 $code = new BCGcode128();
                 $code->setScale(3);
                 // Resolution
                 $code->setThickness(40);
                 // Thickness
                 $code->setForegroundColor($this->color_black);
                 // Color of bars
                 $code->setBackgroundColor($this->color_white);
                 // Color of spaces
                 $code->setFont($this->barcodeFont);
                 // Font (or 0)
                 $code->parse($track->getNumber());
                 // Text
             } catch (Exception $exception) {
                 $drawException = $exception;
             }
             /* Here is the list of the arguments
             			1 - Filename (empty : display on screen)
             			2 - Background color */
             $barcodeFile = tempnam(Mage::getConfig()->getOptions()->getTmpDir(), 'BarCode_Ship');
             $drawing = new BCGDrawing($barcodeFile, $this->color_white);
             if ($drawException) {
                 $drawing->drawException($drawException);
             } else {
                 $drawing->setBarcode($code);
                 $drawing->draw();
             }
             // Draw (or save) the image into PNG format.
             $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
             // RENAME FILE
             $pngFile = $barcodeFile . ".png";
             rename($barcodeFile, $pngFile);
             $image = Zend_Pdf_Image::imageWithPath($pngFile);
             $page->drawImage($image, 60, 75, 260, 175);
             unlink($pngFile);
         }
     }
     // Now do the order Shipping Number
     // Convert to barcode
     $drawException = null;
     try {
         $code = new BCGcode128();
         $code->setScale(3);
         // Resolution
         $code->setThickness(40);
         // Thickness
         $code->setForegroundColor($this->color_black);
         // Color of bars
         $code->setBackgroundColor($this->color_white);
         // Color of spaces
         $code->setFont($this->barcodeFont);
         // Font (or 0)
         $code->parse($shipment->getIncrementId());
         // Text
     } catch (Exception $exception) {
         $drawException = $exception;
     }
     /* Here is the list of the arguments
     			1 - Filename (empty : display on screen)
     			2 - Background color */
     $barcodeFile = tempnam(Mage::getConfig()->getOptions()->getTmpDir(), 'BarCode_Ship');
     $drawing = new BCGDrawing($barcodeFile, $this->color_white);
     if ($drawException) {
         $drawing->drawException($drawException);
     } else {
         $drawing->setBarcode($code);
         $drawing->draw();
     }
     // Draw (or save) the image into PNG format.
     $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
     // RENAME FILE
     $pngFile = $barcodeFile . ".png";
     rename($barcodeFile, $pngFile);
     $image = Zend_Pdf_Image::imageWithPath($pngFile);
     $page->drawImage($image, 350, 65, 550, 155);
     unlink($pngFile);
 }
コード例 #10
0
ファイル: test.php プロジェクト: marsa1985/kazabiz
// Including all required classes
require 'class/BCGFont.php';
require 'class/BCGColor.php';
require 'class/BCGDrawing.php';
// Including the barcode technology
include 'class/BCGcode128.barcode.php';
$num = $_GET['num'];
// Loading Font
$font = new BCGFont('./class/font/Arial.ttf', 13);
// The arguments are R, G, B for color.
$color_black = new BCGColor(0, 0, 0);
$color_white = new BCGColor(255, 255, 255);
$drawException = null;
try {
    $code = new BCGcode128();
    //$code->setScale(1.5); // Resolution
    $code->setThickness(40);
    // Thickness
    $code->setForegroundColor($color_black);
    // Color of bars
    $code->setBackgroundColor($color_white);
    // Color of spaces
    $code->setFont($font);
    // Font (or 0)
    $code->parse($num);
    // Text
} catch (Exception $exception) {
    $drawException = $exception;
}
/* Here is the list of the arguments
コード例 #11
0
ファイル: barcode.php プロジェクト: husmen73/on-muhasebe
function replace_text_for_utf8($text)
{
    $text = trim($text);
    $search = array('Ç', 'ç', 'Ğ', 'ğ', 'ı', 'İ', 'Ö', 'ö', 'Ş', 'ş', 'Ü', 'ü', ' ');
    $replace = array('c', 'c', 'g', 'g', 'i', 'i', 'o', 'o', 's', 's', 'u', 'u', '-');
    $new_text = str_replace($search, $replace, $text);
    return $new_text;
}
if (isset($_GET['text'])) {
    $text = $_GET['text'];
} else {
    $text = 'no-text';
}
$text = replace_text_for_utf8(strtolower($text));
// Barcode Part
$code = new BCGcode128();
$code->setScale(2);
$code->setThickness(30);
$code->setForegroundColor($color_black);
$code->setBackgroundColor($color_white);
$code->setFont($font);
$code->setStart(NULL);
$code->setTilde(true);
$code->parse($text);
// Drawing Part
$drawing = new BCGDrawing('', $color_white);
$drawing->setBarcode($code);
$drawing->draw();
header('Content-Type: image/png');
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
?>
コード例 #12
0
ファイル: opdcard.php プロジェクト: robocon/shs
// Including all required classes
require_once 'class/BCGFontFile.php';
require_once 'class/BCGColor.php';
require_once 'class/BCGDrawing.php';
// Including the barcode technology
require_once 'class/BCGcode128.barcode.php';
// Loading Font
$font = new BCGFontFile('./font/angsa.ttf', 12);
// Don't forget to sanitize user inputs
$text = $runnoopd;
// The arguments are R, G, B for color.
$color_black = new BCGColor(0, 0, 0);
$color_white = new BCGColor(255, 255, 255);
$drawException = null;
try {
    $code = new BCGcode128();
    $code->setScale(1);
    // Resolution
    $code->setThickness(35);
    // Thickness
    $code->setForegroundColor($color_black);
    // Color of bars
    $code->setBackgroundColor($color_white);
    // Color of spaces
    $code->setFont($font);
    // Font (or 0)
    $code->parse($text);
    // Text
} catch (Exception $exception) {
    $drawException = $exception;
}
コード例 #13
0
ファイル: _barcode.php プロジェクト: bvillac/websea
<?php

/* SOLUCION VALIDA */
$ruta = Yii::app()->basePath;
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();
コード例 #14
0
ファイル: buys_controller.php プロジェクト: roae/hello-world
 function barcode($text)
 {
     #App::import('Vendor','BarcodeFont',array('file'=>'barcode'.DS.'BCGFontFile.php'));
     #App::import('Vendor','BarcodeColor',array('file'=>'barcode'.DS.'BCGColor.php'));
     App::import('Vendor', 'BarcodeDrawing', array('file' => 'barcode' . DS . 'BCGDrawing.php'));
     App::import('Vendor', 'Barcode128', array('file' => 'barcode' . DS . 'BCGcode128.barcode.php'));
     #pr(VENDORS.'barcode'.DS.'Arial.ttf');
     #$font = new BCGFontFile(VENDORS.'barcode'.DS.'Arial.ttf', 18);
     $color_black = new BCGColor(0, 0, 0);
     $color_white = new BCGColor(255, 255, 255);
     $drawException = null;
     try {
         $code = new BCGcode128();
         $code->setScale(2);
         // Resolution
         $code->setThickness(30);
         // Thickness
         $code->setForegroundColor($color_black);
         // Color of bars
         $code->setBackgroundColor($color_white);
         // Color of spaces
         #$code->setFont($font); // Font (or 0)
         $code->parse($text);
         // Text
     } catch (Exception $exception) {
         $drawException = $exception;
     }
     /* Here is the list of the arguments
     		1 - Filename (empty : display on screen)
     		2 - Background color */
     $drawing = new BCGDrawing('', $color_white);
     if ($drawException) {
         $drawing->drawException($drawException);
     } else {
         $drawing->setBarcode($code);
         $drawing->draw();
     }
     // Header that says it is an image (remove it if you save the barcode to a file)
     header('Content-Type: image/png');
     header('Content-Disposition: inline; filename="barcode.png"');
     // Draw (or save) the image into PNG format.
     $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
 }
コード例 #15
0
ファイル: Invoice.php プロジェクト: rajarshc/Rooja
 protected function insertOrderBarCode(&$page, $order)
 {
     // Convert to barcode
     $drawException = null;
     try {
         $code = new BCGcode128();
         $code->setScale(2);
         // Resolution
         $code->setThickness(40);
         // Thickness
         $code->setForegroundColor($this->color_black);
         // Color of bars
         $code->setBackgroundColor($this->color_white);
         // Color of spaces
         $code->setFont($this->barcodeFont);
         // Font (or 0)
         $code->parse($order->getRealOrderId());
         // Text
     } catch (Exception $exception) {
         $drawException = $exception;
     }
     /* Here is the list of the arguments
     		1 - Filename (empty : display on screen)
     		2 - Background color */
     $barcodeFile = tempnam(Mage::getConfig()->getOptions()->getTmpDir(), 'BarCode_Ship');
     $drawing = new BCGDrawing($barcodeFile, $this->color_white);
     if ($drawException) {
         $drawing->drawException($drawException);
     } else {
         $drawing->setBarcode($code);
         $drawing->draw();
     }
     // Draw (or save) the image into PNG format.
     $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
     // RENAME FILE
     $pngFile = $barcodeFile . ".png";
     rename($barcodeFile, $pngFile);
     $image = Zend_Pdf_Image::imageWithPath($pngFile);
     $page->drawImage($image, 418, 752, 568, 820);
     unlink($pngFile);
 }
コード例 #16
0
 /**
  * Parses Text.
  *
  * @param string $text
  */
 public function parse($text)
 {
     parent::parse($this->parseGs1128($text));
 }
コード例 #17
0
 /**
  * Parses Text
  *
  * @param string $text
  */
 public function parse($text)
 {
     parent::parse($this->parseGs1128($text));
     $this->errorText .= $this->errorTextGS1128;
 }
コード例 #18
0
ファイル: download.php プロジェクト: jpbalderas17/ams
}
require_once 'class/BCGFontFile.php';
require_once 'class/BCGColor.php';
require_once 'class/BCGDrawing.php';
require_once 'class/BCGcode128.barcode.php';
$asset = $con->myQuery("SELECT asset_tag,asset_name,model FROM qry_assets WHERE id=?", array($id))->fetch(PDO::FETCH_ASSOC);
if (empty($asset)) {
    Modal("Asset does not Exist.");
    redirect("index.php");
    die;
}
try {
    $colorFront = new BCGColor(0, 0, 0);
    $colorBack = new BCGColor(255, 255, 255);
    $font = new BCGFontFile('./font/Arial.ttf', 11);
    $code = new BCGcode128();
    // Or another class name from the manual
    $code->setScale(2);
    // Resolution
    $code->setThickness(30);
    // Thickness
    $code->setForegroundColor($colorFront);
    // Color of bars
    $code->setBackgroundColor($colorBack);
    // Color of spaces
    $code->setFont($font);
    // Font (or 0)
    $code->parse($asset['asset_tag']);
    $code->clearLabels();
    $labe = new BCGLabel($asset['asset_name'] . " (" . $asset['model'] . ")", $font, BCGLabel::POSITION_TOP);
    $code->addLabel($labe);