Esempio n. 1
0
 /**
  * tag : BARCODE
  * mode : OPEN
  *
  * @param  array $param
  * @return boolean
  */
 protected function _tag_open_BARCODE($param)
 {
     // for  compatibility with old versions < 3.29
     $lstBarcode = array();
     $lstBarcode['UPC_A'] = 'UPCA';
     $lstBarcode['CODE39'] = 'C39';
     if (!isset($param['type'])) {
         $param['type'] = 'C39';
     }
     if (!isset($param['value'])) {
         $param['value'] = 0;
     }
     if (!isset($param['label'])) {
         $param['label'] = 'label';
     }
     if (!isset($param['style']['color'])) {
         $param['style']['color'] = '#000000';
     }
     if ($this->_testIsDeprecated && (isset($param['bar_h']) || isset($param['bar_w']))) {
         throw new HTML2PDF_exception(9, array('BARCODE', 'bar_h, bar_w'));
     }
     $param['type'] = strtoupper($param['type']);
     if (isset($lstBarcode[$param['type']])) {
         $param['type'] = $lstBarcode[$param['type']];
     }
     $this->parsingCss->save();
     $this->parsingCss->analyse('barcode', $param);
     $this->parsingCss->setPosition();
     $this->parsingCss->fontSet();
     $x = $this->pdf->getX();
     $y = $this->pdf->getY();
     $w = $this->parsingCss->value['width'];
     if (!$w) {
         $w = $this->parsingCss->ConvertToMM('50mm');
     }
     $h = $this->parsingCss->value['height'];
     if (!$h) {
         $h = $this->parsingCss->ConvertToMM('10mm');
     }
     $txt = $param['label'] !== 'none' ? $this->parsingCss->value['font-size'] : false;
     $c = $this->parsingCss->value['color'];
     $infos = $this->pdf->myBarcode($param['value'], $param['type'], $x, $y, $w, $h, $txt, $c);
     $this->_maxX = max($this->_maxX, $x + $infos[0]);
     $this->_maxY = max($this->_maxY, $y + $infos[1]);
     $this->_maxH = max($this->_maxH, $infos[1]);
     $this->_maxE++;
     $this->pdf->setXY($x + $infos[0], $y);
     $this->parsingCss->load();
     $this->parsingCss->fontSet();
     return true;
 }