• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TCPDFBarcode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getBarcode

function getBarcode($sample)
{
    require "../tcpdf/tcpdf_barcodes_1d.php";
    if (!$sample) {
        echo "";
    } else {
        $barcodeobj = new TCPDFBarcode($sample, 'C128');
        echo $barcodeobj->getBarcodeHTML(2, 30, 'black');
    }
}
开发者ID:syafiqazwan,项目名称:pharmaco,代码行数:10,代码来源:lab_config1.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: recu

 /**
  * Impression d'un recu grace a l'operation caisse idcaisse
  * Afficher avant de proposer une impression
  * @param type $idcaisse
  */
 public function recu($idcaisse)
 {
     if (!isAuth(522)) {
         return;
     }
     $this->view->clientsJS("caisse" . DS . "recu");
     $view = new View();
     $operation = $this->Caisse->get($idcaisse);
     $view->Assign("operation", $operation);
     $this->loadBarcode(BARCODE_1);
     $barcodeobj = new TCPDFBarcode($operation['REFCAISSE'], 'C128A');
     $view->Assign("barcode", $barcodeobj->getBarcodeHTML(1, 35, 'black'));
     $personnel = $this->Personnel->getBy(["USER" => $this->session->iduser]);
     if (!empty($operation['PERCUPAR'])) {
         $percepteur = $this->Personnel->get($operation['PERCUPAR']);
         $view->Assign("percepteur", $percepteur);
     }
     if (!empty($operation['IMPRIMERPAR'])) {
         $imprimeur = $this->Personnel->get($operation['IMPRIMERPAR']);
     } else {
         $imprimeur = $personnel;
     }
     $percepteur = $this->Personnel->get($operation['PERCUPAR']);
     $view->Assign("percepteur", $percepteur);
     $enregistreur = $this->Personnel->get($operation['ENREGISTRERPAR']);
     $view->Assign("enregistreur", $enregistreur);
     $view->Assign("imprimeur", $imprimeur);
     $view->Assign("estDirectrice", $this->session->idprofile === DIRECTOR_PROFILE ? true : false);
     $classe = $this->Eleve->getClasse($operation['ELEVE'], $this->session->anneeacademique);
     $view->Assign("classe", $classe);
     $montantapayer = $this->Frais->getClasseTotalFrais($classe['IDCLASSE']);
     $view->Assign("montantapayer", $montantapayer);
     $montantpayer = $this->Caisse->getMontantPayer($operation['ELEVE']);
     $view->Assign("montantpayer", $montantpayer);
     $content = $view->Render("caisse" . DS . "recu", false);
     $this->Assign("content", $content);
 }
开发者ID:jpainam,项目名称:cosba,代码行数:42,代码来源:caisseController.php


示例4: getBarCodeHTML

 public function getBarCodeHTML()
 {
     $barcode = new TCPDFBarcode("E:{$this->id}", 'C128');
     return $barcode->getBarcodeHTML(1, 8);
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:5,代码来源:Event.php


示例5: 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


示例6: dirname

//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
 * @file
 * Example for tcpdf_barcodes_1d.php class
 * @package com.tecnick.tcpdf
 * @author Nicola Asuni
 * @version 1.0.000
 */
// include 1D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_1d.php';
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as SVG inline code
echo $barcodeobj->getBarcodeSVGcode(2, 40, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:ade24,项目名称:vcorner,代码行数:31,代码来源:example_1d_svgi.php


示例7: dirname

//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
 * @file
 * Example for tcpdf_barcodes_1d.php class
 * @package com.tecnick.tcpdf
 * @author Nicola Asuni
 * @version 1.0.000
 */
// include 1D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_1d.php';
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as HTML object
echo $barcodeobj->getBarcodeHTML(2, 30, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:myindexlike,项目名称:MODX.snippets,代码行数:31,代码来源:example_1d_html.php


示例8: dirname

//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_2d.php class
//
//============================================================+
/**
 * @file
 * Example for tcpdf_barcodes_2d.php class
 * @package com.tecnick.tcpdf
 * @author Nicola Asuni
 * @version 1.0.000
 */
// include 1D barcode class (search for installation path)
require_once dirname(__FILE__) . '/tcpdf_barcodes_1d_include.php';
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(2, 30, array(0, 0, 0));
//============================================================+
// END OF FILE
//============================================================+
开发者ID:tcsoftwareaustin,项目名称:vint,代码行数:31,代码来源:example_1d_png.php


示例9: 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


示例10: generatePDF

 function generatePDF($action = 'return')
 {
     if (!in_array($action, ['return', 'dump'])) {
         throw $this->exception('Please provide action as result or dump');
     }
     $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('xEpan ERP');
     $pdf->SetTitle($this['type'] . ' ' . $this['document_no']);
     $pdf->SetSubject($this['type'] . ' ' . $this['document_no']);
     $pdf->SetKeywords($this['type'] . ' ' . $this['document_no']);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set font
     $pdf->SetFont('dejavusans', '', 10);
     //remove header or footer hr lines
     $pdf->SetPrintHeader(false);
     $pdf->SetPrintFooter(false);
     // add a page
     $pdf->AddPage();
     if ($org = $this->ref('contact_id')->get('organization')) {
         $this['contact'] = $org;
         $this['contact_id'] = '';
     }
     // getting layouts from config
     $layout_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['master' => 'xepan\\base\\RichText', 'detail' => 'xepan\\base\\RichText'], 'config_key' => strtoupper($this['type']) . '_LAYOUT', 'application' => 'commerce']);
     $layout_m->tryLoadAny();
     $info_config = $layout_m['master'];
     $info_layout = $this->add('GiTemplate');
     $info_layout->loadTemplateFromString($info_config);
     $detail_config = $layout_m['detail'];
     $detail_layout = $this->add('GiTemplate');
     $detail_layout->loadTemplateFromString($detail_config);
     $new = $this->add('xepan\\commerce\\Model_QSP_Master');
     $new->addHook('afterLoad', function ($m) {
         $m['round_amount'] = abs($m['round_amount']);
     });
     $new->load($this->id);
     $view = $this->app->add('xepan\\commerce\\View_QSP', ['qsp_model' => $new, 'master_template' => $info_layout, 'detail_template' => $detail_layout, 'action' => 'pdf']);
     // $view = $this->owner->add('xepan\commerce\View_QSP',['qsp_model'=>$this]);
     if ($bar_code = $this->getBarCode()) {
         $barcodeobj = new \TCPDFBarcode($bar_code, 'C128');
         // $barcode_html = $barcodeobj->getBarcodePNG(2, 30, 'black');
         $barcode_html = $barcodeobj->getBarcodePngData(1, 20, array(0, 128, 0));
         $info_layout->trySetHtml('dispatch_barcode', '<img src="data:image/png;base64, ' . base64_encode($barcode_html) . '"/>');
     }
     $html = $view->getHTML();
     // echo "string".$html;
     // echo $html;
     // exit;
     // output the HTML content
     $pdf->writeHTML($html, false, false, true, false, '');
     // set default form properties
     $pdf->setFormDefaultProp(array('lineWidth' => 1, 'borderStyle' => 'solid', 'fillColor' => array(255, 255, 200), 'strokeColor' => array(255, 128, 128)));
     // reset pointer to the last page
     $pdf->lastPage();
     //Close and output PDF document
     switch ($action) {
         case 'return':
             return $pdf->Output(null, 'S');
             break;
         case 'dump':
             return $pdf->Output(null, 'I');
             exit;
             break;
     }
 }
开发者ID:xepan,项目名称:commerce,代码行数:68,代码来源:Master.php


示例11: dirname

//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Example for tcpdf_barcodes_1d.php class
//
//============================================================+
/**
 * @file
 * Example for tcpdf_barcodes_1d.php class
 * @package com.tecnick.tcpdf
 * @author Nicola Asuni
 * @version 1.0.000
 */
// include 1D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_1d.php';
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(2, 30, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:ade24,项目名称:vcorner,代码行数:31,代码来源:example_1d_svg.php


示例12: writeBarCode

 /**
  *	Save an image file on disk (with no output)
  *
  *	@param	   string	    $code		      Value to encode
  *	@param	   string	    $encoding	      Mode of encoding
  *	@param	   string	    $readable	      Code can be read
  *	@param	   integer		$scale			  Scale (not used with this engine)
  *  @param     integer      $nooutputiferror  No output if error (not used with this engine)
  *	@return	   int			                  <0 if KO, >0 if OK
  */
 function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
 {
     global $conf, $_GET;
     dol_mkdir($conf->barcode->dir_temp);
     $file = $conf->barcode->dir_temp . '/barcode_' . $code . '_' . $encoding . '.png';
     $tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
     if (empty($tcpdfEncoding)) {
         return -1;
     }
     $color = array(0, 0, 0);
     $_GET["code"] = $code;
     $_GET["type"] = $encoding;
     $_GET["height"] = $height;
     $_GET["readable"] = $readable;
     if ($code) {
         // Load the tcpdf barcode class
         if ($this->is2d) {
             $height = 1;
             $width = 1;
             require_once TCPDF_PATH . 'tcpdf_barcodes_2d.php';
             $barcodeobj = new TCPDF2DBarcode($code, $tcpdfEncoding);
         } else {
             $height = 50;
             $width = 1;
             require_once TCPDF_PATH . 'tcpdf_barcodes_1d.php';
             $barcodeobj = new TCPDFBarcode($code, $tcpdfEncoding);
         }
         dol_syslog("writeBarCode::TCPDF.getBarcodePngData");
         if ($imageData = $barcodeobj->getBarcodePngData($width, $height, $color)) {
             if (function_exists('imagecreate')) {
                 $imageData = imagecreatefromstring($imageData);
             }
             if (imagepng($imageData, $file)) {
                 return 1;
             } else {
                 return -3;
             }
         } else {
             return -4;
         }
     } else {
         return -2;
     }
 }
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:54,代码来源:tcpdfbarcode.modules.php


示例13: array

                     //echo $db->last_query();
                     if ($numRow == 0) {
                         $qty = $_POST['qty'][$key];
                         $sqlGetInbound = $db->get_where('inbound_po', 'inbound_id = ' . $key);
                         $rsGetInbound = $sqlGetInbound->row_array();
                         $data = array('pallet_id' => $updateID, 'po_id' => $rsGetInbound['po_id'], 'inbound_key' => $rsGetInbound['inbound_id'], 'supplier_id' => $rsGetInbound['po_supplier'], 'qty' => $qty, 'create_time' => _DATE_TIME_, 'user_id' => $user_id);
                         $db->insert('inbound_pallet_item', $data);
                     } else {
                         if ($numRow == 1) {
                             $qty = $_POST['qty'][$key] + $rsRow['qty'];
                             $data = array('qty' => $qty);
                             $db->update('inbound_pallet_item', $data, 'id =' . $rsRow['id']);
                         }
                     }
                     $barcode = str_pad($updateID, 10, "0", STR_PAD_LEFT);
                     $barcodeobj = new TCPDFBarcode($barcode, 'C128');
                     $showBarcode = $barcodeobj->getBarcodePNG(2, 30, array(0, 0, 0), $updateID);
                     $back['barcode'] = '
     <span class="detailBarcode" style="text-align: center; line-height:40px;font-size: 16px;float:right;">
         <span class="barcodeImg" style="margin-left:10px; margin-top:10px;">
             <img class="imgBarcode" src="data:image/png;base64,' . $showBarcode . '" style="" />
         </span>
     </span>
 ';
                     //echo $db->last_query();
                 }
                 $back['actionID'] = $updateID;
                 echo json_encode($back);
             } else {
                 if ($_POST['method'] == 'manage_pallet_success') {
                     $palletID = $_POST['palletID'];
开发者ID:natcha23,项目名称:wmstm,代码行数:31,代码来源:inbound_action.php


示例14: str_pad

    ?>
</td>
                            <td>
                                <button onclick="$.managePallet(<?php 
    echo $arr['pallet_id'];
    ?>
)">จัดการ</button>
                            </td>
                        </tr>
                        <div id="barcode<?php 
    echo $arr['pallet_id'];
    ?>
" style="display: none;">
                            <?php 
    $barcode = str_pad($arr['pallet_id'], 10, "0", STR_PAD_LEFT);
    $barcodeobj = new TCPDFBarcode($barcode, 'C128');
    $showBarcode = $barcodeobj->getBarcodePNG(2, 30, array(0, 0, 0), $arr['pallet_id']);
    echo '
                                <span class="detailBarcode" style="text-align: center; line-height:40px;font-size: 16px;float:right;">
                                    <span class="barcodeImg" style="margin-left:10px; margin-top:10px;">
                                        <img class="imgBarcode" src="data:image/png;base64,' . $showBarcode . '" style="" />
                                    </span>
                                </span>
                            ';
    ?>
                        </div>
                <?php 
}
?>
                </tbody>
            </table>
开发者ID:natcha23,项目名称:wmstm,代码行数:31,代码来源:pallet_manage.php


示例15: getPng

 protected function getPng($code, $type)
 {
     $barcode = new \TCPDFBarcode($code, $type);
     return $barcode->getBarcodePNGData(2, 30, array(0, 0, 0));
 }
开发者ID:martinlindhe,项目名称:core3,代码行数:5,代码来源:Barcode1D.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TCPDF_COLORS类代码示例发布时间:2022-05-23
下一篇:
PHP TCPDF2DBarcode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap