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

PHP TCPDF2DBarcode类代码示例

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

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



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

示例1: crearFirma2

 function crearFirma2()
 {
     if ($this->firmar == 'si') {
         $this->firma['fecha_firma'] = $this->fecha_rep;
         $this->firma['usuario_firma'] = $this->usuario_firma;
         $this->firma['hash'] = md5(json_encode($this->firma));
         $data = json_encode($this->firma);
         $barcodeobj = new TCPDF2DBarcode($data, 'QRCODE,H');
         $QR = imagecreatefromstring($barcodeobj->getBarcodePngData(3, 3, array(0, 0, 0)));
         //$QR = imagecreatefrompng('https://chart.googleapis.com/chart?cht=qr&chld=H|1&chs='.$size.'&chl='.urlencode($data));
         $url = "/tmp/" . $this->firma['hash'] . ".png";
         imagepng($QR, $url);
         imagedestroy($QR);
     } else {
         $url = "";
     }
     return $url;
 }
开发者ID:hcvcastro,项目名称:pxp,代码行数:18,代码来源:ReportePDFFormulario.php


示例2: write2DBarcode

 /**
  * Print 2D Barcode.
  * @param string $code code to print
  * @param string $type type of barcode (see 2dbarcodes.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 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</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></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 4.5.037 (2009-04-07)
  * @access public
  */
 public function write2DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $style = '', $align = '')
 {
     if ($this->empty_string($code)) {
         return;
     }
     require_once dirname(__FILE__) . '/2dbarcodes.php';
     // save current graphic settings
     $gvars = $this->getGraphicVars();
     // create new barcode object
     $barcodeobj = new TCPDF2DBarcode($code, $type);
     $arrcode = $barcodeobj->getBarcodeArray();
     if ($arrcode === false) {
         $this->Error('Error in 2D barcode string');
     }
     // set default values
     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;
     }
     // set foreground color
     $this->SetDrawColorArray($style['fgcolor']);
     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($w) or $w <= 0) {
         if ($this->rtl) {
             $w = $x - $this->lMargin;
         } else {
             $w = $this->w - $this->rMargin - $x;
         }
     }
     if ($this->empty_string($h) or $h <= 0) {
         // 2d barcodes are square by default
         $h = $w;
     }
     $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;
         }
     }
     // calculate barcode size (excluding padding)
     $bw = $w - 2 * $style['padding'];
     $bh = $h - 2 * $style['padding'];
     // calculate starting coordinates
     if ($this->rtl) {
         $xpos = $x - $w;
     } else {
         $xpos = $x;
     }
     $xpos += $style['padding'];
     $ypos = $y + $style['padding'];
     // barcode is always printed in LTR direction
     $tempRTL = $this->rtl;
     $this->rtl = false;
     // print background color
     if ($style['bgcolor']) {
         $this->Rect($x, $y, $w, $h, $style['border'] ? 'DF' : 'F', '', $style['bgcolor']);
     } elseif ($style['border']) {
         $this->Rect($x, $y, $w, $h, 'D');
     }
     // print barcode cells
     if ($arrcode !== false) {
         $rows = $arrcode['num_rows'];
         $cols = $arrcode['num_cols'];
         // calculate dimension of single barcode cell
         $cw = $bw / $cols;
//.........这里部分代码省略.........
开发者ID:retrofox,项目名称:Huemul,代码行数:101,代码来源:tcpdf.php


示例3: F_display_db_error

    if ($m = F_db_fetch_array($r)) {
        // update user level
        $sqlu = 'UPDATE ' . K_TABLE_USERS . ' SET
				user_level=\'1\',
				user_verifycode=NULL
				WHERE user_id=' . $userid . '';
        if (!($ru = F_db_query($sqlu, $db))) {
            F_display_db_error(false);
        } else {
            F_print_error('MESSAGE', $l['m_user_registration_ok']);
            echo K_NEWLINE;
            echo '<div class="container">' . K_NEWLINE;
            if (K_OTP_LOGIN) {
                require_once '../../shared/tcpdf/tcpdf_barcodes_2d.php';
                $host = preg_replace('/[h][t][t][p][s]?[:][\\/][\\/]/', '', K_PATH_HOST);
                $qrcode = new TCPDF2DBarcode('otpauth://totp/' . $m['user_name'] . '@' . $host . '?secret=' . $m['user_otpkey'], 'QRCODE,H');
                echo '<p>' . $l['m_otp_qrcode'] . '</p>' . K_NEWLINE;
                echo '<h2>' . $m['user_otpkey'] . '</h2>' . K_NEWLINE;
                echo '<div style="margin:40px 40px 40px 40px;">' . K_NEWLINE;
                echo $qrcode->getBarcodeHTML(6, 6, 'black');
                echo '</div>' . K_NEWLINE;
            }
            echo '<p><strong><a href="index.php" title="' . $l['h_index'] . '">' . $l['h_index'] . ' &gt;</a></strong></p>' . K_NEWLINE;
            echo '</div>' . K_NEWLINE;
            require_once '../code/tce_page_footer.php';
            exit;
        }
    }
} else {
    F_display_db_error(false);
}
开发者ID:jayadevn,项目名称:RackMap,代码行数:31,代码来源:tce_user_verification.php


示例4: 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.009
 */
// include 2D barcode class (search for installation path)
require_once dirname(__FILE__) . '/tcpdf_barcodes_2d_include.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(4, 4, array(0, 0, 0));
//============================================================+
// END OF FILE
//============================================================+
开发者ID:tcsoftwareaustin,项目名称:vint,代码行数:31,代码来源:example_2d_pdf417_png.php


示例5: 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.009
 */
// include 2D barcode class (search for installation path)
require_once dirname(__FILE__) . '/tcpdf_barcodes_2d_include.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as HTML object
echo $barcodeobj->getBarcodeHTML(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:ashanrupasinghe,项目名称:2015-12-03-from_server_all_pdf_OK,代码行数:31,代码来源:example_2d_qrcode_html.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_2d.php class
//
//============================================================+
/**
 * @file
 * Example for tcpdf_barcodes_2d.php class
 * @package com.tecnick.tcpdf
 * @author Nicola Asuni
 * @version 1.0.009
 */
// include 2D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_2d.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as PNG image
$barcodeobj->getBarcodePNG(6, 6, array(0, 0, 0));
//============================================================+
// END OF FILE
//============================================================+
开发者ID:myindexlike,项目名称:MODX.snippets,代码行数:31,代码来源:example_2d_qrcode_png.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_2d.php class
//
//============================================================+
/**
 * @file
 * Example for tcpdf_barcodes_2d.php class
 * @package com.tecnick.tcpdf
 * @author Nicola Asuni
 * @version 1.0.009
 */
// include 2D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_2d.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(4, 4, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:myindexlike,项目名称:MODX.snippets,代码行数:31,代码来源:example_2d_pdf417_svg.php


示例8: PlantillaCorrespondencia

 function PlantillaCorrespondencia()
 {
     try {
         $this->objParam->addParametro('id_funcionario_usuario', $_SESSION["ss_id_funcionario"]);
         $this->objParam->defecto('ordenacion', 'id_correspondencia');
         $this->objParam->defecto('dir_ordenacion', 'desc');
         $this->objParam->addFiltro("cor.id_correspondencia = " . $this->objParam->getParametro('id_correspondencia'));
         $this->objFunc = $this->create('MODCorrespondencia');
         $this->res = $this->objFunc->listarCorrespondencia();
         if ($this->res->getTipo() == 'ERROR') {
             $this->res->imprimirRespuesta($this->res->generarJson());
             exit;
         }
         $correspondencia = $this->res->getDatos();
         //obtener detalle de envios
         $this->objParam->parametros_consulta['ordenacion'] = 'id_correspondencia';
         $this->objParam->parametros_consulta['filtro'] = ' 0 = 0 ';
         $this->objParam->parametros_consulta['cantidad'] = '1000';
         $this->objParam->addFiltro("cor.id_correspondencia_fk = " . $this->objParam->getParametro('id_correspondencia'));
         $this->objFunc = $this->create('MODCorrespondencia');
         $this->res = $this->objFunc->listarCorrespondenciaDetalle($this->objParam);
         if ($this->res->getTipo() == 'ERROR') {
             $this->res->imprimirRespuesta($this->res->generarJson());
             exit;
         }
         $correspondenciaDetalle = $this->res->getDatos();
         //desc_funcionario -> es el funcionario que lo envia
         //desc_uo ->
         //numero numero de la correspondencia
         /*generamos una imagen qr para ingresar a la plantilla*/
         $cadena_qr = '|' . $correspondencia[0]['numero'] . '|' . $correspondencia[0]['desc_uo'] . '|' . $correspondencia[0]['desc_funcionario'] . '';
         $barcodeobj = new TCPDF2DBarcode($cadena_qr, 'QRCODE,M');
         //todo cambiar ese nombre por algo randon
         $nombre_archivo = md5($_SESSION["ss_id_usuario_ai"] . $_SESSION["_SEMILLA"]);
         $png = $barcodeobj->getBarcodePngData($w = 8, $h = 8, $color = array(0, 0, 0));
         $im = imagecreatefromstring($png);
         if ($im !== false) {
             header('Content-Type: image/png');
             imagepng($im, dirname(__FILE__) . "/../../reportes_generados/" . $nombre_archivo . ".png");
             imagedestroy($im);
             $img_qr = dirname(__FILE__) . "/../../reportes_generados/" . $nombre_archivo . ".png";
             if ($correspondencia[0]['desc_ruta_plantilla_documento'] == NULL) {
                 throw new Exception('no tiene plantilla o no esta en el formato correspondiente');
             }
             /*agrego a la plantilla word los datos */
             $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($correspondencia[0]['desc_ruta_plantilla_documento']);
             $templateProcessor->cloneRow('destinatario', count($correspondenciaDetalle));
             for ($i = 0; $i < count($correspondenciaDetalle); $i++) {
                 $xml_destinatario = htmlspecialchars($correspondenciaDetalle[$i]['desc_funcionario']) . '</w:t>
                                 </w:r>
                             </w:p>
                             <w:p w:rsidR="003D7875" w:rsidRDefault="006C602F" w:rsidP="006C602F">
                                 <w:pPr>
                                     <w:pStyle w:val="Encabezado"/>
                                     <w:tabs>
                                         <w:tab w:val="clear" w:pos="4818"/>
                                         <w:tab w:val="left" w:pos="1276"/>
                                         <w:tab w:val="left" w:pos="2268"/>
                                         <w:tab w:val="left" w:pos="2552"/>
                                     </w:tabs>
                                     <w:jc w:val="both"/>
                                     <w:rPr>
                                         <w:b/>
                                         <w:bCs/>
                                         <w:iCs/>
                                         <w:color w:val="000000"/>
                                         <w:lang w:val="es-ES"/>
                                     </w:rPr>
                                 </w:pPr>
                                 <w:r>
                                     <w:rPr>
                                         <w:b/>
                                         <w:bCs/>
                                         <w:iCs/>
                                         <w:color w:val="000000"/>
                                         <w:lang w:val="es-ES"/>
                                     </w:rPr>
                                     <w:t>' . htmlspecialchars($correspondenciaDetalle[$i]["desc_cargo"]) . '</w:t>
                                 </w:r>
                             </w:p>';
                 $numero_key = $i + 1;
                 $key_name = '${destinatario#' . $numero_key . '}</w:t></w:r></w:p>';
                 $key_2 = '${destinatario#1}</w:t></w:r></w:p>';
                 $templateProcessor->setValueDestinatario($key_name, $xml_destinatario);
                 //$templateProcessor->setValue($key_name, $correspondenciaDetalle[$i]['desc_funcionario'].'<br /> '.$correspondenciaDetalle[$i]['desc_cargo']);
             }
             setlocale(LC_ALL, "es_ES@euro", "es_ES", "esp");
             $fecha_documento = strftime("%d/%m/%Y", strtotime($correspondencia[0]['fecha_documento']));
             $templateProcessor->setImg('firma_digital', array('src' => $img_qr, 'swh' => '150'));
             $templateProcessor->setImgFooter('qr', array('src' => $img_qr, 'swh' => '250'));
             //$templateProcessor->setImgHeader('qrh',array('src' => $img_qr, 'swh'=>'250'));
             $templateProcessor->setValue('remitente', htmlspecialchars($correspondencia[0]['desc_funcionario']));
             $templateProcessor->setValue('cargo_remitente', htmlspecialchars($correspondencia[0]['desc_cargo']));
             $templateProcessor->setValue('referencia', htmlspecialchars($correspondencia[0]['referencia']));
             $templateProcessor->setValue('fecha', htmlspecialchars($fecha_documento));
             $templateProcessor->setValue('mensaje', htmlspecialchars($correspondencia[0]['mensaje']));
             $templateProcessor->setValue('numero', htmlspecialchars($correspondencia[0]['numero']));
             //$templateProcessor->setValue('uo', htmlspecialchars($correspondencia[0]['desc_uo']));
             $templateProcessor->saveAs(dirname(__FILE__) . '/../../reportes_generados/' . $nombre_archivo . '.docx');
             $temp['docx'] = $nombre_archivo . '.docx';
//.........这里部分代码省略.........
开发者ID:kplian,项目名称:sis_correspondencia,代码行数:101,代码来源:ACTCorrespondencia.php


示例9: 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.009
 */
// include 2D barcode class (search for installation path)
require_once dirname(__FILE__) . '/tcpdf_barcodes_2d_include.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as HTML object
echo $barcodeobj->getBarcodeHTML(4, 4, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:RA2WP,项目名称:RA2WP,代码行数:31,代码来源:example_2d_pdf417_html.php


示例10: 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.009
 */
// include 2D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_2d.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as SVG inline code
echo $barcodeobj->getBarcodeSVGcode(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:myindexlike,项目名称:MODX.snippets,代码行数:31,代码来源:example_2d_qrcode_svgi.php


示例11: array

<?php

include_once 'jwt/vendor/autoload.php';
include_once 'TCPDF/tcpdf_barcodes_2d.php';
include_once 'uuid/vendor/autoload.php';
$signer = new \Lcobucci\JWT\Signer\Hmac\Sha512();
$token = (new Lcobucci\JWT\Builder())->setIssuer('http://example.com')->setAudience('http://example.org')->setId(\Ramsey\Uuid\Uuid::uuid4(), true)->setIssuedAt(time())->setNotBefore(time() + 60)->setExpiration(time() + 3600)->set('uid', array('user_select', 'user_delete'))->sign($signer, 'testing')->getToken();
// Retrieves the generated token
//echo $token; // The string representation of the object is a JWT string (pretty easy, right?)
$barcodeobj = new TCPDF2DBarcode((string) $token, 'QRCODE,H');
header('Content-Type:application/json');
echo json_encode(array('token' => (string) $token, 'link' => 'http://jwt.io#id_token=' . $token, 'barcode' => $barcodeobj->getBarcodeHTML(3, 3)));
开发者ID:piotrgolasz,项目名称:jwt,代码行数:12,代码来源:jwt_over_barcode.php


示例12: getAsPng

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


示例13: 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.009
 */
// include 2D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_2d.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(6, 6, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:ade24,项目名称:vcorner,代码行数:31,代码来源:example_2d_qrcode_svg.php


示例14: 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.009
 */
// include 2D barcode class
require_once dirname(__FILE__) . '/../../tcpdf_barcodes_2d.php';
// set the barcode content and type
$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417');
// output the barcode as SVG inline code
echo $barcodeobj->getBarcodeSVGcode(4, 4, 'black');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:ade24,项目名称:vcorner,代码行数:31,代码来源:example_2d_pdf417_svgi.php


示例15: write2DBarcode

 /**
  * Print 2D Barcode.
  * @param $code (string) code to print
  * @param $type (string) type of barcode (see tcpdf_barcodes_2d.php for supported formats).
  * @param $x (int) x position in user units
  * @param $y (int) y position in user units
  * @param $w (int) width in user units
  * @param $h (int) height in user units
  * @param $style (array) 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 barcode units (set to 'auto' for automatic padding)</li>
  * <li>int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)</li>
  * <li>int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)</li>
  * <li>int $style['module_width'] width of a single module in points</li>
  * <li>int $style['module_height'] height of a single module in points</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>string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch</li><li>$style['module_width'] width of a single module in points</li>
  * <li>$style['module_height'] height of a single module in points</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>
  * @param $distort (boolean) if true distort the barcode to fit width and height, otherwise preserve aspect ratio
  * @author Nicola Asuni
  * @since 4.5.037 (2009-04-07)
  * @public
  */
 public function write2DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $style = '', $align = '', $distort = false)
 {
     if (TCPDF_STATIC::empty_string(trim($code))) {
         return;
     }
     require_once dirname(__FILE__) . '/tcpdf_barcodes_2d.php';
     // save current graphic settings
     $gvars = $this->getGraphicVars();
     // create new barcode object
     $barcodeobj = new TCPDF2DBarcode($code, $type);
     $arrcode = $barcodeobj->getBarcodeArray();
     if ($arrcode === false or empty($arrcode) or !isset($arrcode['num_rows']) or $arrcode['num_rows'] == 0 or !isset($arrcode['num_cols']) or $arrcode['num_cols'] == 0) {
         $this->Error('Error in 2D 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;
     }
     // padding
     if (!isset($style['padding'])) {
         $style['padding'] = 0;
     } elseif ($style['padding'] === 'auto') {
         $style['padding'] = 4;
     }
     if (!isset($style['hpadding'])) {
         $style['hpadding'] = $style['padding'];
     } elseif ($style['hpadding'] === 'auto') {
         $style['hpadding'] = 4;
     }
     if (!isset($style['vpadding'])) {
         $style['vpadding'] = $style['padding'];
     } elseif ($style['vpadding'] === 'auto') {
         $style['vpadding'] = 4;
     }
     $hpad = 2 * $style['hpadding'];
     $vpad = 2 * $style['vpadding'];
     // cell (module) dimension
     if (!isset($style['module_width'])) {
         $style['module_width'] = 1;
         // width of a single module in points
     }
     if (!isset($style['module_height'])) {
         $style['module_height'] = 1;
         // height of a single module in points
     }
     if ($x === '') {
         $x = $this->x;
     }
     if ($y === '') {
         $y = $this->y;
     }
     // check page for no-write regions and adapt page margins if necessary
     list($x, $y) = $this->checkPageRegions($h, $x, $y);
     // number of barcode columns and rows
     $rows = $arrcode['num_rows'];
     $cols = $arrcode['num_cols'];
     if ($rows <= 0 || $cols <= 0) {
         $this->Error('Error in 2D barcode string');
     }
     // module width and height
     $mw = $style['module_width'];
     $mh = $style['module_height'];
     if ($mw <= 0 or $mh <= 0) {
         $this->Error('Error in 2D barcode string');
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php


示例16: min

            $w = min(10, max(5, $size));
            $h = 2/5 * $w;
            $barcodeObj = new TCPDF2DBarcode($payload, $requested_code_type);
            $barcodeObj->getBarcodePNG($w, $h, [$red, $green, $blue]);
            break;
        
        case 'QR':
            /** Handle raw-looking QR **/
            break;

        case 'FANCYQR':
            /** @TODO handle fancy QR code creation * */
            $imagePadding=12; // @IMPORTANT - make an even number
            $std_wh = max([$w, $h]);
            $w = $size; $h = $size;
            $barcodeObj = new TCPDF2DBarcode($payload, 'QRCODE,H');
            $imgData = $barcodeObj->getBarcodePNGData($w, $h, [$red, $green, $blue]);
            $imgSize = getimagesizefromstring($imgData);
            // get png-8 image 
            $img = imagecreatetruecolor($imgSize[0]+$imagePadding,$imgSize[1]+$imagePadding);
            imagefill($img, 0, 0, imagecolorallocate($img,255,255,255));
            // write temp file
            $temp_filename = TMP_DIR . date('YmdHis') . '__TEMP.PNG';
            file_put_contents($temp_filename, $imgData);
            $imgsrc = imagecreatefrompng($temp_filename);
            // convert to png-24
            $margin = -1 * ($imagePadding/2);
            imagecopy($img,$imgsrc,0,0,$margin,$margin,$imgSize[0]+$imagePadding,$imgSize[1]+$imagePadding);            
            // config
            $matrixPointSize = min(max((int)$size, 1), 50);
            // blur factor
开发者ID:uchilaka,项目名称:docfactory,代码行数:31,代码来源:index.php


示例17: setBarcode

 public function setBarcode($code, $type = 'DATAMATRIX')
 {
     if ($type !== 'DATAMATRIX') {
         return parent::setBarcode($code, $type);
     }
     $qrcode = new DatamatrixBase256($code);
     $this->barcode_array = $qrcode->getBarcodeArray();
     $this->barcode_array['code'] = $code;
 }
开发者ID:ixalender,项目名称:datamatrixbase256,代码行数:9,代码来源:tcpdf_datamatrix_base256.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP TCPDFBarcode类代码示例发布时间:2022-05-23
下一篇:
PHP TCPDF类代码示例发布时间: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