コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
//
// 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
//============================================================+
コード例 #4
0
 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';
             $this->res->setDatos($temp);
             $this->res->imprimirRespuesta($this->res->generarJson());
         } else {
             echo 'ocurrio un error al guardar la imagen.';
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage(), 2);
     }
     //fin catch
 }
コード例 #5
0
//
// 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
//============================================================+
コード例 #6
0
ファイル: jwt_over_barcode.php プロジェクト: piotrgolasz/jwt
<?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)));
コード例 #7
0
ファイル: Barcode2D.php プロジェクト: martinlindhe/core3
 protected function getAsPng($code, $type)
 {
     $barcode = new \TCPDF2DBarcode($code, $type);
     return $barcode->getBarcodePNGData(6, 6, array(0, 0, 0));
 }
コード例 #8
0
//
// 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
//============================================================+
コード例 #9
0
ファイル: tcpdf.php プロジェクト: TheTypoMaster/myapps
 /**
  * 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');
     }
     // get max dimensions
     if ($this->rtl) {
         $maxw = $x - $this->lMargin;
     } else {
         $maxw = $this->w - $this->rMargin - $x;
     }
     $maxh = $this->h - $this->tMargin - $this->bMargin;
     $ratioHW = ($rows * $mh + $hpad) / ($cols * $mw + $vpad);
     $ratioWH = ($cols * $mw + $vpad) / ($rows * $mh + $hpad);
     if (!$distort) {
         if ($maxw * $ratioHW > $maxh) {
             $maxw = $maxh * $ratioWH;
         }
         if ($maxh * $ratioWH > $maxw) {
             $maxh = $maxw * $ratioHW;
         }
     }
     // set maximum dimesions
     if ($w > $maxw) {
         $w = $maxw;
     }
     if ($h > $maxh) {
         $h = $maxh;
     }
     // set dimensions
     if (($w === '' or $w <= 0) and ($h === '' or $h <= 0)) {
         $w = ($cols + $hpad) * ($mw / $this->k);
         $h = ($rows + $vpad) * ($mh / $this->k);
     } elseif ($w === '' or $w <= 0) {
         $w = $h * $ratioWH;
     } elseif ($h === '' or $h <= 0) {
         $h = $w * $ratioHW;
     }
     // barcode size (excluding padding)
     $bw = $w * $cols / ($cols + $hpad);
     $bh = $h * $rows / ($rows + $vpad);
     // dimension of single barcode cell unit
     $cw = $bw / $cols;
     $ch = $bh / $rows;
     if (!$distort) {
         if ($cw / $ch > $mw / $mh) {
             // correct horizontal distortion
             $cw = $ch * $mw / $mh;
             $bw = $cw * $cols;
             $style['hpadding'] = ($w - $bw) / (2 * $cw);
         } else {
             // correct vertical distortion
             $ch = $cw * $mh / $mw;
             $bh = $ch * $rows;
             $style['vpadding'] = ($h - $bh) / (2 * $ch);
         }
     }
     // fit the barcode on available space
     list($w, $h, $x, $y) = $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') {
             $xpos = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
         } elseif ($style['position'] == 'R') {
             $xpos = $this->w - $this->rMargin - $w;
         } else {
             $xpos = $x - $w;
         }
         $this->img_rb_x = $xpos;
     } else {
         if ($style['position'] == 'L') {
             $xpos = $this->lMargin;
         } elseif ($style['position'] == 'C') {
             $xpos = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
         } elseif ($style['position'] == 'R') {
             $xpos = $this->w - $this->rMargin - $w;
         } else {
             $xpos = $x;
         }
         $this->img_rb_x = $xpos + $w;
     }
     $xstart = $xpos + $style['hpadding'] * $cw;
     $ystart = $y + $style['vpadding'] * $ch;
     // barcode is always printed in LTR direction
     $tempRTL = $this->rtl;
     $this->rtl = false;
     // print background color
     if ($style['bgcolor']) {
         $this->Rect($xpos, $y, $w, $h, $style['border'] ? 'DF' : 'F', '', $style['bgcolor']);
     } elseif ($style['border']) {
         $this->Rect($xpos, $y, $w, $h, 'D');
     }
     // set foreground color
     $this->SetDrawColorArray($style['fgcolor']);
     // print barcode cells
     // for each row
     for ($r = 0; $r < $rows; ++$r) {
         $xr = $xstart;
         // for each column
         for ($c = 0; $c < $cols; ++$c) {
             if ($arrcode['bcode'][$r][$c] == 1) {
                 // draw a single barcode cell
                 $this->Rect($xr, $ystart, $cw, $ch, 'F', array(), $style['fgcolor']);
             }
             $xr += $cw;
         }
         $ystart += $ch;
     }
     // restore original direction
     $this->rtl = $tempRTL;
     // restore previous settings
     $this->setGraphicVars($gvars);
     // set pointer to align the next text/objects
     switch ($align) {
         case 'T':
             $this->y = $y;
             $this->x = $this->img_rb_x;
             break;
         case 'M':
             $this->y = $y + round($h / 2);
             $this->x = $this->img_rb_x;
             break;
         case 'B':
             $this->y = $this->img_rb_y;
             $this->x = $this->img_rb_x;
             break;
         case 'N':
             $this->SetY($this->img_rb_y);
             break;
         default:
             break;
     }
     $this->endlinex = $this->img_rb_x;
 }
コード例 #10
0
ファイル: index.php プロジェクト: uchilaka/docfactory
            $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
コード例 #11
0
ファイル: tcpdf.php プロジェクト: retrofox/Huemul
 /**
  * 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;
         $ch = $bh / $rows;
         // for each row
         for ($r = 0; $r < $rows; ++$r) {
             $xr = $xpos;
             // for each column
             for ($c = 0; $c < $cols; ++$c) {
                 if ($arrcode['bcode'][$r][$c] == 1) {
                     // draw a single barcode cell
                     $this->Rect($xr, $ypos, $cw, $ch, 'F', array(), $style['fgcolor']);
                 }
                 $xr += $cw;
             }
             $ypos += $ch;
         }
     }
     // restore original direction
     $this->rtl = $tempRTL;
     // restore previous settings
     $this->setGraphicVars($gvars);
     // set bottomcoordinates
     $this->img_rb_y = $y + $h;
     if ($this->rtl) {
         // set left side coordinate
         $this->img_rb_x = $this->w - $x - $w;
     } else {
         // set right side coordinate
         $this->img_rb_x = $x + $w;
     }
     // set pointer to align the successive text/objects
     switch ($align) {
         case 'T':
             $this->y = $y;
             $this->x = $this->img_rb_x;
             break;
         case 'M':
             $this->y = $y + round($h / 2);
             $this->x = $this->img_rb_x;
             break;
         case 'B':
             $this->y = $this->img_rb_y;
             $this->x = $this->img_rb_x;
             break;
         case 'N':
             $this->SetY($this->img_rb_y);
             break;
         default:
             break;
     }
 }
コード例 #12
0
//
// 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
//============================================================+
コード例 #13
0
    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);
}
コード例 #14
0
//
// 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
//============================================================+
// 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
//============================================================+
コード例 #16
0
//
// 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
//============================================================+
コード例 #17
-1
//
// 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
//============================================================+