当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDFBarcode::getBarcodeArray方法代码示例

本文整理汇总了PHP中TCPDFBarcode::getBarcodeArray方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDFBarcode::getBarcodeArray方法的具体用法?PHP TCPDFBarcode::getBarcodeArray怎么用?PHP TCPDFBarcode::getBarcodeArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDFBarcode的用法示例。


在下文中一共展示了TCPDFBarcode::getBarcodeArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write1DBarcode

 /**
  * Print a Linear Barcode.
  * @param string $code code to print
  * @param string $type type of barcode (see barcodes.php for supported formats).
  * @param int $x x position in user units
  * @param int $y y position in user units
  * @param int $w width in user units
  * @param int $h height in user units
  * @param float $xres width of the smallest bar in user units
  * @param array $style array of options:<ul><li>string $style['position'] barcode position inside the specified width: L = left (default for LTR); C = center; R = right (default for RTL); S = stretch</li><li>boolean $style['border'] if true prints a border around the barcode</li><li>int $style['padding'] padding to leave around the barcode in user units</li><li>array $style['fgcolor'] color array for bars and text</li><li>mixed $style['bgcolor'] color array for background or false for transparent</li><li>boolean $style["text"] boolean if true prints text below the barcode</li><li>string $style['font'] font name for text</li><li>int $style['fontsize'] font size for text</li><li>int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing</li></ul>
  * @param string $align Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul>
  * @author Nicola Asuni
  * @since 3.1.000 (2008-06-09)
  * @access public
  */
 public function write1DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = 0.4, $style = '', $align = '')
 {
     if ($this->empty_string($code)) {
         return;
     }
     require_once dirname(__FILE__) . '/barcodes.php';
     // save current graphic settings
     $gvars = $this->getGraphicVars();
     // create new barcode object
     $barcodeobj = new TCPDFBarcode($code, $type);
     $arrcode = $barcodeobj->getBarcodeArray();
     if ($arrcode === false) {
         $this->Error('Error in 1D barcode string');
     }
     // set default values
     if (!isset($style['position'])) {
         if ($this->rtl) {
             $style['position'] = 'R';
         } else {
             $style['position'] = 'L';
         }
     }
     if (!isset($style['padding'])) {
         $style['padding'] = 0;
     }
     if (!isset($style['fgcolor'])) {
         $style['fgcolor'] = array(0, 0, 0);
         // default black
     }
     if (!isset($style['bgcolor'])) {
         $style['bgcolor'] = false;
         // default transparent
     }
     if (!isset($style['border'])) {
         $style['border'] = false;
     }
     $fontsize = 0;
     if (!isset($style['text'])) {
         $style['text'] = false;
     }
     if ($style['text'] and isset($style['font'])) {
         if (isset($style['fontsize'])) {
             $fontsize = $style['fontsize'];
         }
         $this->SetFont($style['font'], '', $fontsize);
     }
     if (!isset($style['stretchtext'])) {
         $style['stretchtext'] = 4;
     }
     // set foreground color
     $this->SetDrawColorArray($style['fgcolor']);
     $this->SetTextColorArray($style['fgcolor']);
     if ($this->empty_string($w) or $w <= 0) {
         if ($this->rtl) {
             $w = $this->x - $this->lMargin;
         } else {
             $w = $this->w - $this->rMargin - $this->x;
         }
     }
     if ($this->empty_string($x)) {
         $x = $this->GetX();
     }
     if ($this->rtl) {
         $x = $this->w - $x;
     }
     if ($this->empty_string($y)) {
         $y = $this->GetY();
     }
     if ($this->empty_string($xres)) {
         $xres = 0.4;
     }
     $fbw = $arrcode['maxw'] * $xres + 2 * $style['padding'];
     $extraspace = $this->cell_height_ratio * $fontsize / $this->k + 2 * $style['padding'];
     if ($this->empty_string($h) or $h <= 0) {
         $h = 10 + $extraspace;
     }
     $prev_x = $this->x;
     if ($this->checkPageBreak($h, $y)) {
         $y = $this->GetY() + $this->cMargin;
         if ($this->rtl) {
             $x += $prev_x - $this->x;
         } else {
             $x += $this->x - $prev_x;
         }
     }
//.........这里部分代码省略.........
开发者ID:retrofox,项目名称:Huemul,代码行数:101,代码来源:tcpdf.php

示例2: write1DBarcode

 /**
  * Print a Linear Barcode.
  * @param $code (string) code to print
  * @param $type (string) type of barcode (see tcpdf_barcodes_1d.php for supported formats).
  * @param $x (int) x position in user units (empty string = current x position)
  * @param $y (int) y position in user units (empty string = current y position)
  * @param $w (int) width in user units (empty string = remaining page width)
  * @param $h (int) height in user units (empty string = remaining page height)
  * @param $xres (float) width of the smallest bar in user units (empty string = default value = 0.4mm)
  * @param $style (array) array of options:<ul>
  * <li>boolean $style['border'] if true prints a border</li>
  * <li>int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)</li>
  * <li>int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)</li>
  * <li>int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)</li>
  * <li>array $style['fgcolor'] color array for bars and text</li>
  * <li>mixed $style['bgcolor'] color array for background (set to false for transparent)</li>
  * <li>boolean $style['text'] if true prints text below the barcode</li>
  * <li>string $style['label'] override default label</li>
  * <li>string $style['font'] font name for text</li><li>int $style['fontsize'] font size for text</li>
  * <li>int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.</li>
  * <li>string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.</li>
  * <li>string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.</li>
  * <li>string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.</li>
  * <li>string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.</li>
  * <li>string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.</li></ul>
  * @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul>
  * @author Nicola Asuni
  * @since 3.1.000 (2008-06-09)
  * @public
  */
 public function write1DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = '', $style = '', $align = '')
 {
     if (TCPDF_STATIC::empty_string(trim($code))) {
         return;
     }
     require_once dirname(__FILE__) . '/tcpdf_barcodes_1d.php';
     // save current graphic settings
     $gvars = $this->getGraphicVars();
     // create new barcode object
     $barcodeobj = new TCPDFBarcode($code, $type);
     $arrcode = $barcodeobj->getBarcodeArray();
     if ($arrcode === false or empty($arrcode) or $arrcode['maxw'] <= 0) {
         $this->Error('Error in 1D barcode string');
     }
     if ($arrcode['maxh'] <= 0) {
         $arrcode['maxh'] = 1;
     }
     // set default values
     if (!isset($style['position'])) {
         $style['position'] = '';
     } elseif ($style['position'] == 'S') {
         // keep this for backward compatibility
         $style['position'] = '';
         $style['stretch'] = true;
     }
     if (!isset($style['fitwidth'])) {
         if (!isset($style['stretch'])) {
             $style['fitwidth'] = true;
         } else {
             $style['fitwidth'] = false;
         }
     }
     if ($style['fitwidth']) {
         // disable stretch
         $style['stretch'] = false;
     }
     if (!isset($style['stretch'])) {
         if ($w === '' or $w <= 0) {
             $style['stretch'] = false;
         } else {
             $style['stretch'] = true;
         }
     }
     if (!isset($style['fgcolor'])) {
         $style['fgcolor'] = array(0, 0, 0);
         // default black
     }
     if (!isset($style['bgcolor'])) {
         $style['bgcolor'] = false;
         // default transparent
     }
     if (!isset($style['border'])) {
         $style['border'] = false;
     }
     $fontsize = 0;
     if (!isset($style['text'])) {
         $style['text'] = false;
     }
     if ($style['text'] and isset($style['font'])) {
         if (isset($style['fontsize'])) {
             $fontsize = $style['fontsize'];
         }
         $this->SetFont($style['font'], '', $fontsize);
     }
     if (!isset($style['stretchtext'])) {
         $style['stretchtext'] = 4;
     }
     if ($x === '') {
         $x = $this->x;
     }
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php

示例3: write1DBarcode

 /**
  * Print a Linear Barcode.
  * @param string $code code to print
  * @param string $type type of barcode (see barcodes.php for supported formats).
  * @param int $x x position in user units
  * @param int $y y position in user units
  * @param int $w width in user units
  * @param int $h height in user units
  * @param float $xres width of the smallest bar in user units
  * @param array $style array of options:<ul><li>boolean $style['border'] if true prints a border around the barcode</li><li>int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)</li><li>array $style['fgcolor'] color array for bars and text</li><li>mixed $style['bgcolor'] color array for background or false for transparent</li><li>boolean $style["text"] boolean if true prints text below the barcode</li><li>string $style['font'] font name for text</li><li>int $style['fontsize'] font size for text</li><li>int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing</li><li>string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch</li></ul>
  * @param string $align Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul>
  * @author Nicola Asuni
  * @since 3.1.000 (2008-06-09)
  * @access public
  */
 public function write1DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = 0.4, $style = '', $align = '')
 {
     if ($this->empty_string(trim($code))) {
         return;
     }
     require_once dirname(__FILE__) . '/barcodes.php';
     // save current graphic settings
     $gvars = $this->getGraphicVars();
     // create new barcode object
     $barcodeobj = new TCPDFBarcode($code, $type);
     $arrcode = $barcodeobj->getBarcodeArray();
     if ($arrcode === false) {
         $this->Error('Error in 1D barcode string');
     }
     // set default values
     if (!isset($style['position'])) {
         $style['position'] = '';
     }
     if (!isset($style['fgcolor'])) {
         $style['fgcolor'] = array(0, 0, 0);
         // default black
     }
     if (!isset($style['bgcolor'])) {
         $style['bgcolor'] = false;
         // default transparent
     }
     if (!isset($style['border'])) {
         $style['border'] = false;
     }
     $fontsize = 0;
     if (!isset($style['text'])) {
         $style['text'] = false;
     }
     if ($style['text'] and isset($style['font'])) {
         if (isset($style['fontsize'])) {
             $fontsize = $style['fontsize'];
         }
         $this->SetFont($style['font'], '', $fontsize);
     }
     if (!isset($style['stretchtext'])) {
         $style['stretchtext'] = 4;
     }
     // set foreground color
     $this->SetDrawColorArray($style['fgcolor']);
     $this->SetTextColorArray($style['fgcolor']);
     if ($x === '') {
         $x = $this->x;
     }
     if ($y === '') {
         $y = $this->y;
     }
     if ($w === '' or $w <= 0) {
         if ($this->rtl) {
             $w = $this->x - $this->lMargin;
         } else {
             $w = $this->w - $this->rMargin - $this->x;
         }
     }
     if ($h === '' or $h <= 0) {
         // horizontal aspect ration by default
         $h = $w / 3;
     }
     if ($this->empty_string($xres)) {
         $xres = 0.4;
     }
     // padding
     if (!isset($style['padding'])) {
         $style['padding'] = 0;
     } elseif ($style['padding'] === 'auto') {
         $style['padding'] = $h / 4;
     }
     $fbw = $arrcode['maxw'] * $xres + 2 * $style['padding'];
     $extraspace = $this->cell_height_ratio * $fontsize / $this->k + 2 * $style['padding'];
     // maximum bar height
     $barh = $h;
     $h += $extraspace;
     // fit the barcode on available space
     $this->fitBlock($w, $h, $x, $y, false);
     // set alignment
     $this->img_rb_y = $y + $h;
     // set alignment
     if ($this->rtl) {
         if ($style['position'] == 'L') {
             $xpos = $this->lMargin;
         } elseif ($style['position'] == 'C') {
//.........这里部分代码省略.........
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:101,代码来源:tcpdf.php


注:本文中的TCPDFBarcode::getBarcodeArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。