示例#1
0
 public function getBarcodeImgSource()
 {
     $type = "code128";
     $orderId = $this->getOrder()->getIncrementId();
     $barcodeOptions = array('text' => $orderId, 'fontSize' => "14", 'withQuietZones' => true);
     $rendererOptions = array();
     $imageResource = Zend_Barcode::factory($type, 'image', $barcodeOptions, $rendererOptions);
     return $imageResource;
 }
示例#2
0
 public function generateBarcodeAction()
 {
     $product_code = $this->getRequest()->getParam('product_code');
     header('Content-type: image/png');
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $barcodeOptions = array('text' => "{$product_code}", 'barHeight' => 40);
     $rendererOptions = array();
     $renderer = Zend_Barcode::factory('code128', 'image', $barcodeOptions, $rendererOptions)->render();
 }
示例#3
0
 function barcode_generate($kode)
 {
     $houseno = $this->post('houseno');
     //$height =25;//tinggi barcode
     //$width = 3; //ketebalan barcode
     $this->load->library('zend');
     $this->zend->load('Zend/Barcode');
     $barcodeOPT = array('text' => $kode, 'barHeight' => $height, 'factor' => $width);
     $renderOPT = array();
     $render = Zend_Barcode::factory('code128', 'image', $barcodeOPT, $renderOPT)->render();
 }
示例#4
0
文件: Main.php 项目: projukti/dumkal
 private function set_barcode($code)
 {
     //load library
     $this->load->library('zend');
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     //Zend_Barcode::render('code128', 'image', array('text'=>$code), array());
     $barcodeOptions = array('text' => $code, 'barHeight' => 20, 'factor' => 1);
     $rendererOptions = array();
     $renderer = Zend_Barcode::factory('code128', 'image', $barcodeOptions, $rendererOptions)->render();
 }
示例#5
0
 function gambar($kode)
 {
     $height = 60;
     //tinggi barcode
     $width = 2;
     //ketebalan barcode
     $this->load->library('zend');
     $this->zend->load('Zend/Barcode');
     $barcodeOPT = array('text' => $kode, 'barHeight' => $height, 'factor' => $width);
     $renderOPT = array();
     $render = Zend_Barcode::factory('code128', 'image', $barcodeOPT, $renderOPT)->render();
 }
示例#6
0
 public function generate($code)
 {
     //load library
     $this->load->library('zend');
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     //Zend_Barcode::render('code128', 'image', array('text'=>$code), array());
     $barcodeOptions = array('text' => $code);
     $rendererOptions = array('imageType' => 'png', 'horizontalPosition' => 'center', 'verticalPosition' => 'middle');
     $imageResource = Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions)->render();
     return $imageResource;
 }
 /**
  * Return barcode image
  */
 public function getImage($barcode)
 {
     $barcodeStandard = Mage::getStoreConfig('barcodelabel/general/standard');
     // WARNING option withChecksum = false is ignored for EAN 13 ! we have to cut the barcode if ean13 is enable
     if ($barcodeStandard == "Ean13") {
         $barcode = substr($barcode, 0, 12);
     }
     $barcodeOptions = array('text' => $barcode);
     // barcode attribut (not sku!)
     $rendererOptions = array();
     // default = empty
     $factory = Zend_Barcode::factory($barcodeStandard, 'image', $barcodeOptions, $rendererOptions);
     $image = $factory->draw();
     return $image;
 }
示例#8
0
文件: image.php 项目: G-LAB/glab-cms
	function barcode () {
	
		require 'Zend/Barcode.php';
		//require 'Zend/Barcode/Object/Code39.php';
		//require 'Zend/Barcode/Renderer/Image.php';
		
		$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');
		$rendererOptions = array();
		
		try {
			$barcode = Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions);
		} catch (Exception $e) {
		    echo 'Caught exception: ',  $e->getMessage(), "\n";
		}
		
		print_r($barcode);
	}
 public function getimageAction()
 {
     $params = $this->getRequest()->getParams();
     $type = $params['type'];
     $code = $params['text'];
     if (isset($params['customize']) && $params['customize']) {
         $heigth = $params['heigth_barcode'];
         $barcodeOptions = array('text' => $code, 'barHeight' => $heigth, 'fontSize' => $params['font_size'], 'withQuietZones' => true);
     } else {
         $barcodeOptions = array('text' => $code, 'fontSize' => $params['font_size'], 'withQuietZones' => true);
     }
     // No required options
     $rendererOptions = array();
     // Draw the barcode in a new image,
     // send the headers and the image
     $imageResource = Zend_Barcode::factory($type, 'image', $barcodeOptions, $rendererOptions);
     imagepng($imageResource->draw(), Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . 'inventorybarcode' . DS . 'images' . DS . 'barcode' . DS . 'barcode.png');
     $imageResource->render();
 }
示例#10
0
 public function indexAction()
 {
     $product_id = $this->getRequest()->getParam('product_id');
     if (!isset($product_id) || !is_numeric($product_id)) {
         exit;
     }
     $eanprefix_code = '012345';
     $product = Mage::getModel('catalog/product')->load($product_id);
     $ean_code = $this->ean13_check_digit($eanprefix_code . str_pad($product->getId(), 5, "0", STR_PAD_LEFT));
     //var_dump($ean_code);die();
     include_once Mage::getBaseDir('lib') . 'Zend/Barcode.php';
     $barcodeOptions = array('text' => $ean_code);
     $rendererOptions = array();
     try {
         $renderer = Zend_Barcode::factory('ean13', 'image', $barcodeOptions, $rendererOptions)->render();
     } catch (Exception $e) {
     }
     exit;
 }
示例#11
0
 public function testFactoryWithExistingBarcodeObject()
 {
     $this->_checkGDRequirement();
     $barcode = new Zend_Barcode_Object_Code25();
     $renderer = Zend_Barcode::factory($barcode);
     $this->assertSame($barcode, $renderer->getBarcode());
 }
 public function gerarcodigodebarrasAction()
 {
     //$this->_helper->layout->disableLayout();
     $pronac = $_GET['pronac'];
     $barcodeOptions = array('text' => $pronac);
     $rendererOptions = array();
     $codigo = Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions)->draw();
     copy($codigo, 'D:/imagem');
     //xd($codigo);
 }
示例#13
0
    require_once LIB . 'Zend/Barcode.php';
    $act = isset($get->act) ? trim($get->act) : 'save';
    $output = isset($get->output) ? trim($get->output) : 'image';
    $ext = $output == 'image' ? $mode : 'pdf';
    $file_name = '../../images/barcodes/' . $code . '.' . $ext;
    $options = array('text' => $code);
    //$options['barHeight'] = 50;
    //$options['barThickWidth'] = 3;
    //$options['barThinWidth'] = 1;
    $options['factor'] = $scale;
    //$options['foreColor'] = "#000000";
    //$options['backgroundColor'] = "#FFFFFF";
    //$options['reverseColor'] = FALSE;
    //$options['orientation'] = 0;
    $options['font'] = "./DejaVuSans.ttf";
    //$options['fontSize'] = 10;
    //$options['withBorder'] = FALSE;
    //$options['withQuietZones'] = TRUE;
    //$options['drawText'] = TRUE;
    //$options['stretchText'] = FALSE;
    //$options['withChecksum'] = FALSE;
    //$options['withChecksumInText'] = FALSE;
    // output the barcode
    $renderer = Zend_Barcode::factory($encoding, $output, $options, array());
    if ($act == 'save') {
        call_user_func('image' . $mode, $renderer->draw(), $file_name);
    } else {
        $renderer->render();
    }
}
exit;
示例#14
0
文件: Data.php 项目: rcclaudrey/dev
 public function getBarcodeImageFile($text, $resultType = 'url')
 {
     $text = strtoupper($text);
     $fileName = preg_replace('/[^0-9A-Z-]/', '', $text);
     $cacheDir = Mage::getModel('core/config')->getVarDir() . self::BARCODE_CACHE_DIR;
     for ($distriDepth = 0; $distriDepth < self::BARCODE_CACHE_DISTRI_DEPTH; $distriDepth++) {
         $cacheDir .= strlen($fileName) > $distriDepth ? '/' . $fileName[$distriDepth] : '';
     }
     $cachePath = $cacheDir . DS . $fileName . '.' . self::BARCODE_IMAGE_TYPE;
     if (!file_exists($cachePath)) {
         if (!file_exists($cacheDir)) {
             mkdir($cacheDir, 0777, true);
         }
         $config = new Zend_Config(array('barcode' => 'code39', 'barcodeParams' => array('text' => $text), 'renderer' => 'image', 'rendererParams' => array('imageType' => self::BARCODE_IMAGE_TYPE)));
         $barcode = Zend_Barcode::factory($config);
         $imageFunction = 'image' . self::BARCODE_IMAGE_TYPE;
         $result = $imageFunction($barcode->draw(), $cachePath);
         if (!$result) {
             return false;
         }
     }
     switch ($resultType) {
         case 'url':
             $result = Mage::getUrl('', array('_direct' => str_replace(Mage::getBaseDir() . DS, '', $cachePath)));
             break;
         case 'magepath':
             $result = str_replace(Mage::getBaseDir() . DS, '', $cachePath);
             break;
         case 'fullpath':
         default:
             $result = $cachePath;
     }
     return $result;
 }
示例#15
0
 function gen_barcode($product_code = NULL, $height = 60, $width = 210)
 {
     if ($this->input->get('code')) {
         $product_code = $this->input->get('code');
     }
     if ($this->input->get('height')) {
         $height = $this->input->get('height');
     }
     if ($this->input->get('width')) {
         $width = $this->input->get('width');
     }
     $this->load->library('zend');
     $this->zend->load('Zend/Barcode');
     //'drawText' => FALSE
     $barcodeOptions = array('text' => $product_code, 'barHeight' => $height);
     $rendererOptions = array('imageType' => 'png', 'horizontalPosition' => 'center', 'verticalPosition' => 'middle', 'width' => $width);
     $imageResource = Zend_Barcode::factory(BARCODE_SYMBOLOGY, 'image', $barcodeOptions, $rendererOptions)->render();
     return $imageResource;
 }
示例#16
0
 /**
  * Adds a barcode representing the order number to the shipment if activated.
  *
  * @param  Varien_Event_Observer $observer observer which is passed by magento
  *
  * @return FireGento_Pdf_Model_Observer
  */
 public function addBarcode(Varien_Event_Observer $observer)
 {
     if (!Mage::getStoreConfigFlag('sales_pdf/shipment/order_id_as_barcode')) {
         return $this;
     }
     $page = $observer->getPage();
     $order = $observer->getOrder();
     $barcodeConfig = array('drawText' => false, 'orientation' => 90, 'text' => $order->getIncrementId());
     $rendererConfig = array('verticalPosition' => 'middle', 'moduleSize' => 0.9);
     // create dummy Zend_Pdf object, which just stores the current page, so that we can pass it in
     // Zend_Barcode_Renderer_Pdf->setResource()
     $pdf = new Zend_Pdf();
     $pdf->pages[] = $page;
     /** @var $renderer Zend_Barcode_Renderer_Pdf */
     $renderer = Zend_Barcode::factory('code128', 'pdf', $barcodeConfig, $rendererConfig)->setResource($pdf, 0);
     // calculate left offset so that barcode is printed on the right with a little margin
     $leftOffset = $page->getWidth() - $renderer->getBarcode()->getWidth(true) * $renderer->getModuleSize() - 10;
     $renderer->setLeftOffset($leftOffset);
     $renderer->draw();
     return $this;
 }
示例#17
0
 public function getBarcodeImgSource($value)
 {
     if (!isset($value)) {
         return '';
     }
     $type = "code128";
     $barcodeOptions = array('text' => $value, 'fontSize' => "14", 'withQuietZones' => true);
     $rendererOptions = array();
     $imageResource = Zend_Barcode::factory($type, 'image', $barcodeOptions, $rendererOptions);
     return $imageResource;
 }
示例#18
0
<?php

//require_once('../../src/autoload.php');
// Carregando autoload PHP 5.3
require_once '../../src/PHPBol.php';
\PHPBol\PHPBol::register();
// Twig
require_once '../../vendor/Twig/lib/Twig/Autoloader.php';
Twig_Autoloader::register();
// Zend_Barcode
//$zendPath = dirname(__FILE__) . '/../../vendor/';
//set_include_path(get_include_path() . PATH_SEPARATOR . $zendPath);
//require_once 'Zend/Loader/Autoloader.php';
//$loader = Zend_Loader_Autoloader::getInstance();
$zendPath = '/var/www/scripts/library/';
set_include_path(get_include_path() . PATH_SEPARATOR . $zendPath);
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$barcodeOptions = array('text' => '104927277414990200040000000114296508600000012609');
$rendererOptions = array();
$renderer = Zend_Barcode::factory('Code25interleaved', 'image', $barcodeOptions, $rendererOptions);
//$renderer->draw();
$renderer->render();
 function imprimir()
 {
     $this->load->library('Pdf');
     $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $this->load->library('zend');
     //load in folder Zend
     $this->zend->load('Zend/Barcode');
     //generate barcode
     $fichas = $this->Ficha->buscar_imprimir();
     foreach ($fichas as $f) {
         $res = Zend_Barcode::factory('code128', 'image', array('text' => $f['clave']), array());
         $res = $res->draw();
         imagepng($res, './codigos/' . $f['clave'] . '.png');
     }
     //$pdf->SetAuthor('Israel Parra');
     // $pdf->SetTitle('Ejemplo de provincías con TCPDF');
     //$pdf->SetSubject('Tutorial TCPDF');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config_alt.php de libraries/config
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128));
     $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128));
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //relación utilizada para ajustar la conversión de los píxeles
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // ---------------------------------------------------------
     // establecer el modo de fuente por defecto
     $pdf->setFontSubsetting(true);
     // Establecer el tipo de letra
     //Si tienes que imprimir carácteres ASCII estándar, puede utilizar las fuentes básicas como
     // Helvetica para reducir el tamaño del archivo.
     $pdf->SetFont('freemono', '', 14, '', true);
     // Añadir una página
     // Este método tiene varias opciones, consulta la documentación para más información.
     $pdf->AddPage();
     //fijar efecto de sombra en el texto
     $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
     // Establecemos el contenido para imprimir
     $fichas = $this->Ficha->buscar_imprimir();
     //foreach($fichas as $fila)
     $i = 0;
     while ($i < 1) {
         $clave = $fichas[$i]['clave'];
         //
         //preparamos y maquetamos el contenido a crear
         $html = '';
         $html .= "<style type=text/css>";
         $html .= "th{color: #fff; font-weight: bold; background-color: #222}";
         $html .= "td{background-color: #AAC7E3; color: #fff}";
         $html .= "</style>";
         $html .= '<img src="./codigos/' . $clave . '.png">';
         //generate barcode
         //$html .= Zend_Barcode::render('code128', 'image', array('text'=>$clave), array())->render();
         $style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 4, 'module_height' => 3);
         $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 4, $fill = 0, $reseth = true, $align = '', $autopadding = true);
         //$pdf->Ln();
         //$pdf->Addpage();
         $i++;
     }
     // ---------------------------------------------------------
     // Cerrar el documento PDF y preparamos la salida
     // Este método tiene varias opciones, consulte la documentación para más información.
     $nombre_archivo = utf8_decode("Demandas.pdf");
     $pdf->Output($nombre_archivo, 'I');
 }
 /**
  * Método que prepara o documento com os dados
  * @param \Core_Dto_Entity $dtoEntityPessoa
  * @param \Core_Dto_Entity $dtoEntityModelo
  * @param boolean $view
  * @return string $file
  */
 public function doc($dtoEntityArtefato, $dtoEntityModelo, $view)
 {
     $registry = \Zend_Registry::get('configs');
     $options = array('path' => $registry['folder']['visualizaMinuta']);
     // inicio consultas dos dados de todos 'pessoa_funcao' envolvidas na minuta
     $arrOrigem = $this->getEntityManager()->getRepository('app:ArtefatoMinuta')->getPessoaOrigemArtefato($dtoEntityArtefato);
     $arrDestino = $this->getEntityManager()->getRepository('app:ArtefatoMinuta')->getPessoaDestinatarioArtefato($dtoEntityArtefato);
     $arrInteressado = $this->getEntityManager()->getRepository('app:PessoaInteressadaArtefato')->getPessoaInteressadaArtefato($dtoEntityArtefato);
     $arrAssinatura = $this->getEntityManager()->getRepository('app:ArtefatoMinuta')->getPessoaAssinaturaArtefato($dtoEntityArtefato);
     $arrRodape = $this->getEntityManager()->getRepository('app:PessoaArtefato')->getPessoaArtefatoRodape($dtoEntityArtefato);
     // fim consultas dos dados de todos 'pessoa_funcao' envolvidas na minuta
     $objModeloMinuta = $this->getServiceLocator()->getService('modeloMinuta')->findModelo($dtoEntityModelo);
     $arrCampo = $this->getCamposModelo($objModeloMinuta['sqModeloDocumento']);
     $entityArtefato = $this->getEntityManager()->getRepository('app:Artefato')->find($dtoEntityArtefato->getSqArtefato());
     // barcode do numero da digital
     $config = new \Zend_Config(array('barcode' => 'Code25interleaved', 'barcodeParams' => array('text' => str_replace(array('E', '-'), '', $arrOrigem['nuDigital']), 'drawText' => FALSE, 'barHeight' => 50, 'barWidth' => 60), 'renderer' => 'image', 'rendererParams' => array('imageType' => 'gif')));
     $path = current(explode('application', __DIR__)) . 'data' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'documento' . DIRECTORY_SEPARATOR;
     $imgBarcode = $path . 'barcode.jpg';
     if (file_exists($imgBarcode)) {
         unlink($imgBarcode);
     }
     $renderer = \Zend_Barcode::factory($config)->draw();
     imagejpeg($renderer, $imgBarcode);
     imagedestroy($renderer);
     $arrOrigem['bar_code'] = $imgBarcode;
     // path para o arquivo utilizado como referencia para criacao do pdf
     \Core_Doc_Factory::setFilePath(APPLICATION_PATH . '/modules/artefato/views/scripts/visualizar-caixa-minuta');
     $file = "{$objModeloMinuta['noPadraoModeloDocumento']}.pdf";
     $data = array('arrOrigem' => $arrOrigem, 'arrDestino' => $arrDestino, 'arrInteressado' => $arrInteressado, 'arrAssinatura' => $arrAssinatura, 'arrRodape' => $arrRodape, 'arrCampo' => $arrCampo, 'viewFor' => $view, 'entity' => $entityArtefato);
     // retorna os dados para a controller para renderizar no phtml e não sno pdf..
     if ($view) {
         return $data;
     }
     return $this->gerarDoc($objModeloMinuta['sqPadraoModeloDocumento'], $data, $options, $file);
 }
示例#21
0
	public function generateBarcodevssAction(){
		$id = $this->getRequest()->getParam('id');
		header('Content-type: image/png');
		$this->_helper->layout()->disableLayout();
		//$barcodeOptions = array('text' => "$_itemcode",'barHeight' => 30);
		$barcodeOptions = array('text' => "Developed By VSS",'barHeight' => 20);
		//'font' => 4(set size of label),//'barHeight' => 40//set height of img barcode
		$rendererOptions = array();
		$renderer = Zend_Barcode::factory(
				'code128', 'image', $barcodeOptions, $rendererOptions
		)->render();
	}
示例#22
-10
 /**
  * [createBarcode description]
  * @param  string $type   [Code128,Code25,Code25interleaved,Ean2,Ean5,Ean8,Ean13,Code39,Identcode,Itf14,Upca,Upce]
  * @param  string $str    [Kode Barcode]
  * @param  string $height [optional height]
  * @param  string $width  [optional width]
  * @return [type]         [description]
  */
 function createBarcode($type, $str, $height = '48', $width = '1.7')
 {
     $this->CI->load->library('ext/zend', 'Zend/Barcode');
     $barcodeOPT = array('text' => $str, 'barHeight' => $height, 'factor' => $width, 'drawText' => TRUE);
     $renderOPT = array();
     $render = Zend_Barcode::factory($type, 'image', $barcodeOPT, $renderOPT)->render();
 }