我使用http://www.barcodebakery.com使用zebra p2824 +打印机打印条形码,有些用户说条形码有时不会扫描。
并非每个人都会这样;但是有一个人有2台打印机,他们都没有工作。他们能够打印其他扫描程序的条形码;但这些条形码偶尔也不会扫描。
输出:
http://demo.phppointofsalestaging.com/barcode.html
条形码创建:
$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);
HTML / php输出条形码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo lang('items_generate_barcodes'); ?></title>
</head>
<body style="margin: 0;">
<table width='50%' align='center' cellpadding='20'>
<tr>
<?php
for($k=0;$k<count($items);$k++)
{
$item = $items[$k];
$barcode = $item['id'];
$text = $item['name'];
$page_break_after = ($k == count($items) -1) ? 'auto' : 'always';
echo "<div style='width: 2in;height: .8in;word-wrap: break-word;overflow: hidden;margin:0 auto;text-align:center;font-size: 10pt;line-height: 1em;page-break-after: $page_break_after;padding: 10px;'>".$this->config->item('company')."<br /><img src='".site_url('barcode').'?barcode='.rawurlencode($barcode).'&text='.rawurlencode($barcode)."&scale=$scale' /><br />".$text."</div>";
}
?>
</tr>
</table>
</body>
</html>