/**
  *显示页.
  */
 public function view($code)
 {
     App::Import('Vendor', 'barcode', array('file' => 'barcode.class.php'));
     $b = new BarCode();
     $this->layout = 'blank';
     $encoding = '128';
     $scale = '2';
     $mode = 'png';
     $b->barcode_print($code, $encoding, $scale, $mode);
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  * @param string $a1
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont, $a1 = '')
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->setText($text);
     $this->textfont = $textfont;
     $this->a1 = $a1;
 }
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  * @param char $start
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont, $start = 'B')
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     if ($start == 'A') {
         $this->starting = 103;
     } elseif ($start == 'B') {
         $this->starting = 104;
     } elseif ($start == 'C') {
         $this->starting = 105;
     }
     $this->ending = 106;
     $this->currentCode = $start;
     /* CODE 128 A */
     $this->keysA = array(' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', chr(128), chr(129));
     /* CODE 128 B */
     $this->keysB = array(' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '', '', '', '', chr(128), '', chr(130));
     /* CODE 128 C */
     $this->keysC = array();
     for ($i = 0; $i <= 99; $i++) {
         $this->keysC[] = sprintf('%02d', $i);
     }
     $this->keysC[] = chr(129);
     $this->keysC[] = chr(130);
     $this->code = array('101111', '111011', '111110', '010112', '010211', '020111', '011102', '011201', '021101', '110102', '110201', '120101', '001121', '011021', '011120', '002111', '012011', '012110', '112100', '110021', '110120', '102101', '112001', '201020', '200111', '210011', '210110', '201101', '211001', '211100', '101012', '101210', '121010', '000212', '020012', '020210', '001202', '021002', '021200', '100202', '120002', '120200', '001022', '001220', '021020', '002012', '002210', '022010', '202010', '100220', '120020', '102002', '102200', '102020', '200012', '200210', '220010', '201002', '201200', '221000', '203000', '110300', '320000', '000113', '000311', '010013', '010310', '030011', '030110', '001103', '001301', '011003', '011300', '031001', '031100', '130100', '110003', '302000', '130001', '023000', '000131', '010031', '010130', '003101', '013001', '013100', '300101', '310001', '310100', '101030', '103010', '301010', '000032', '000230', '020030', '003002', '003200', '300002', '300200', '002030', '003020', '200030', '300020', '100301', '100103', '100121', '122000');
     $this->setText($text);
     $this->textfont = $textfont;
     $this->usingCode($start);
     $this->starting_text = $start;
 }
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  */
 public function __construct($text, $maxHeight = 0, $res = 1, $color1 = array(0, 0, 0), $color2 = array(255, 255, 255), $textfont = 3, $start = 'B')
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     $this->code = array('11000', '00011', '00101', '00110', '01001', '01010', '01100', '10001', '10010', '10100');
     $this->setText($text);
     $this->textfont = $textfont;
 }
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     $this->code = array('11000', '00011', '00101', '00110', '01001', '01010', '01100', '10001', '10010', '10100');
     $this->setText($text);
     $this->textfont = $textfont;
 }
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  */
 public function __construct($text, $maxHeight = 0, $res = 1, $color1 = array(0, 0, 0), $color2 = array(255, 255, 255), $textfont = 3)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->starting = $this->ending = 47;
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%', '($)', '(%)', '(/)', '(+)', '*');
     $this->code = array('020001', '000102', '000201', '000300', '010002', '010101', '010200', '000003', '020100', '030000', '100002', '100101', '100200', '110001', '110100', '120000', '001002', '001101', '001200', '011001', '021000', '000012', '000111', '000210', '010011', '020010', '101001', '101100', '100011', '100110', '110010', '111000', '001011', '001110', '011010', '012000', '010020', '200001', '200100', '210000', '001020', '002010', '100020', '010110', '201000', '200010', '011100', '000030');
     $this->setText($text);
     $this->textfont = $textfont;
 }
Ejemplo n.º 7
0
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  * @param bool $checksum
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont, $checksum = false)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     $this->code = array('0000202000', '2000000020', '0020000020', '2020000000', '0000200020', '2000200000', '0020200000', '0000002020', '2000002000', '0020002000');
     $this->setText($text);
     $this->textfont = $textfont;
     $this->checksum = $checksum;
 }
Ejemplo n.º 8
0
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  * @param bool $checksum
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont, $checksum = false)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->starting = $this->ending = 43;
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%', '*');
     $this->code = array('0001101000', '1001000010', '0011000010', '1011000000', '0001100010', '1001100000', '0011100000', '0001001010', '1001001000', '0011001000', '1000010010', '0010010010', '1010010000', '0000110010', '1000110000', '0010110000', '0000011010', '1000011000', '0010011000', '0000111000', '1000000110', '0010000110', '1010000100', '0000100110', '1000100100', '0010100100', '0000001110', '1000001100', '0010001100', '0000101100', '1100000010', '0110000010', '1110000000', '0100100010', '1100100000', '0110100000', '0100001010', '1100001000', '0110001000', '0101010000', '0101000100', '0100010100', '0001010100', '0100101000');
     $this->setText($text);
     $this->textfont = $textfont;
     $this->checksum = $checksum;
 }
Ejemplo n.º 9
0
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     // Left-Hand Odd Parity starting with a space
     // Right-Hand is the same of Left-Hand starting with a bar
     $this->code = array('2100', '1110', '1011', '0300', '0021', '0120', '0003', '0201', '0102', '2001');
     $this->setText($text);
     $this->textfont = $textfont;
 }
Ejemplo n.º 10
0
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     $this->code = array('2100', '1110', '1011', '0300', '0021', '0120', '0003', '0201', '0102', '2001');
     // Parity, 0=Odd, 1=Even. Depending on ?%4
     $this->codeParity = array(array(0, 0), array(0, 1), array(1, 0), array(1, 1));
     $this->setText($text);
     $this->textfont = $textfont;
 }
Ejemplo n.º 11
0
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  */
 public function __construct($maxHeight, FColor $color1, FColor $color2, $res, $text, $textfont)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     // Odd Parity starting with a space
     // Even Parity is the inverse (0=0012) starting with a space
     $this->code = array('2100', '1110', '1011', '0300', '0021', '0120', '0003', '0201', '0102', '2001');
     // Parity, 0=Odd, 1=Even for manufacturer code. Depending on 1st System Digit and Checksum
     $this->codeParity = array(array(array(1, 1, 1, 0, 0, 0), array(1, 1, 0, 1, 0, 0), array(1, 1, 0, 0, 1, 0), array(1, 1, 0, 0, 0, 1), array(1, 0, 1, 1, 0, 0), array(1, 0, 0, 1, 1, 0), array(1, 0, 0, 0, 1, 1), array(1, 0, 1, 0, 1, 0), array(1, 0, 1, 0, 0, 1), array(1, 0, 0, 1, 0, 1)), array(array(0, 0, 0, 1, 1, 1), array(0, 0, 1, 0, 1, 1), array(0, 0, 1, 1, 0, 1), array(0, 0, 1, 1, 1, 0), array(0, 1, 0, 0, 1, 1), array(0, 1, 1, 0, 0, 1), array(0, 1, 1, 1, 0, 0), array(0, 1, 0, 1, 0, 1), array(0, 1, 0, 1, 1, 0), array(0, 1, 1, 0, 1, 0)));
     $this->setText($text);
     $this->textfont = $textfont;
 }
 /**
  * Constructor
  *
  * @param int $maxHeight
  * @param FColor $color1
  * @param FColor $color2
  * @param int $res
  * @param string $text
  * @param int $textfont
  */
 public function __construct($text, $maxHeight = 0, $res = 1, $color1 = array(0, 0, 0), $color2 = array(255, 255, 255), $textfont = 3)
 {
     BarCode::__construct($maxHeight, $color1, $color2, $res);
     $this->keys = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     // Left-Hand Odd Parity starting with a space
     // Left-Hand Even Parity is the inverse (0=0012) starting with a space
     // Right-Hand is the same of Left-Hand starting with a bar
     $this->code = array('2100', '1110', '1011', '0300', '0021', '0120', '0003', '0201', '0102', '2001');
     // Parity, 0=Odd, 1=Even for manufacturer code. Depending on 1st System Digit
     $this->codeParity = array(array(0, 0, 0, 0, 0), array(0, 1, 0, 1, 1), array(0, 1, 1, 0, 1), array(0, 1, 1, 1, 0), array(1, 0, 0, 1, 1), array(1, 1, 0, 0, 1), array(1, 1, 1, 0, 0), array(1, 0, 1, 0, 1), array(1, 0, 1, 1, 0), array(1, 1, 0, 1, 0));
     $this->setText($text);
     $this->textfont = $textfont;
 }
Ejemplo n.º 13
0
<?php

include_once "class.barcode.php";
$valor = isset($_POST['valor']) ? $_POST['valor'] : "34191183400000292011090000107160253500375000";
// Valor Inicial
$barcode = new BarCode($valor);
$barcode->drawBarCode();
?>
</p>
<form name="form1" method="post" action="">
  <font face="Arial, Helvetica, sans-serif" size="2"><b>Digite o valor do c&oacute;digo
  de barras:</b></font><br>
  <input type="text" name="valor" maxlength="50" size="50" value="<?php 
echo $valor;
?>
">
  <input type="submit" name="Submit" value="Gerar C&oacute;digo de Barrar">
</form>
<br>
</body>
</html>
Ejemplo n.º 14
0
function getBarcode($barcode)
{
    include_once WEB_PATH . 'lib/Barcode.class.php';
    $barcode = new BarCode($barcode, $barcode);
    $barcode->createBarCode();
}