本文整理汇总了PHP中TCPDF::write2DBarcode方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::write2DBarcode方法的具体用法?PHP TCPDF::write2DBarcode怎么用?PHP TCPDF::write2DBarcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::write2DBarcode方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPdfFileData
/**
* @param TicketsOrder $order
* @param string $format 'S': data string - 'I' to see in browser
* @return string
*/
public function getPdfFileData(TicketsOrder $order, $format = 'S')
{
$pdf = new \TCPDF();
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Billets du Louvre');
$pdf->SetTitle('Commande ' . $order->getRef());
$pdf->setPrintHeader(false);
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set style for barcode
$style = array('border' => 0, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
/** @var Ticket $ticket */
foreach ($order->getTickets() as $ticket) {
$pdf->AddPage();
$html = $this->renderTicket(array('visit_date' => $order->getVisitDate()->format('d/m/Y'), 'visit_duration' => $order->getVisitDuration(), 'code' => $order->getRef(), 'ticket_name' => $ticket->getName(), 'price' => $ticket->getPrice(), 'details' => $ticket->getTicketDetails()));
$pdf->writeHTML($html, true, false, true);
$pdf->write2DBarcode($order->getRef(), 'QRCODE,H', 150, 10, 50, 50, $style, 'N');
$pdf->lastPage();
}
return $pdf->Output('tickets.pdf', $format);
}
示例2: array
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(0, 0, 0);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 0);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set font
$pdf->SetFont('helvetica', 'B', 50);
// set style for barcode
$style = array('border' => 0, 'vpadding' => 1, 'hpadding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1, 'position' => 'C');
$result = $db->query("SELECT bikeNum FROM bikes ORDER BY bikeNum");
while ($row = $result->fetch_assoc()) {
$pdf->AddPage();
// QRCODE,M : QR-CODE Medium error correction
$pdf->write2DBarcode($systemURL . 'scan.php/rent/' . $row["bikeNum"], 'QRCODE,M', '', 18, '', 90, $style, 'N');
$pdf->MultiCell(0, 0, $row["bikeNum"], 0, 'C', false, 0);
}
$result = $db->query("SELECT standName FROM stands WHERE serviceTag='0' ORDER BY standName");
while ($row = $result->fetch_assoc()) {
$pdf->AddPage();
// QRCODE,M : QR-CODE Medium error correction
$pdf->write2DBarcode($systemURL . 'scan.php/return/' . $row["standName"], 'QRCODE,M', '', 18, '', 90, $style, 'N');
$pdf->MultiCell(0, 0, $row["standName"], 0, 'C', false, 0);
}
//Close and output PDF document
$pdf->Output('qrcodes.pdf', 'D');
示例3: formats
// ---------------------------------------------------------
// NOTE: 2D barcode algorithms must be implemented on 2dbarcode.php class file.
// set font
$pdf->SetFont('helvetica', '', 11);
// add a page
$pdf->AddPage();
// print a message
$txt = "You can also export 2D barcodes in other formats (PNG, SVG, HTML). Check the source code documentation of TCPDF2DBarcode class for further information.";
$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
$pdf->SetFont('helvetica', '', 10);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// write RAW 2D Barcode
$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
$pdf->write2DBarcode($code, 'RAW', 80, 30, 30, 20, $style, 'N');
// write RAW2 2D Barcode
$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
$pdf->write2DBarcode($code, 'RAW2', 80, 60, 30, 20, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// QRCODE,L : QR-CODE Low error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', 20, 30, 50, 50, $style, 'N');
$pdf->Text(20, 25, 'QRCODE L');
// QRCODE,M : QR-CODE Medium error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', 20, 90, 50, 50, $style, 'N');
$pdf->Text(20, 85, 'QRCODE M');
// QRCODE,Q : QR-CODE Better error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,Q', 20, 150, 50, 50, $style, 'N');
$pdf->Text(20, 145, 'QRCODE Q');
示例4: array
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// NOTE: 2D barcode algorithms must be implemented on 2dbarcode.php class file.
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// write RAW 2D Barcode
$pdf->SetXY(30, 30);
$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
$pdf->write2DBarcode($code, 'RAW', '', '', 30, 20, $style, 'N');
$pdf->SetXY(100, 30);
// write RAW2 2D Barcode
$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
$pdf->write2DBarcode($code, 'RAW2', '', '', 30, 20, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// QRCODE,L : QR-CODE Low error correction
$pdf->SetXY(30, 60);
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', '', '', 50, 50, $style, 'N');
$pdf->Text(30, 55, 'QRCODE L');
// QRCODE,M : QR-CODE Medium error correction
$pdf->SetXY(100, 60);
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', '', '', 50, 50, $style, 'N');
$pdf->Text(100, 55, 'QRCODE M');
示例5: array
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
$style = array('border' => true, 'padding' => 4, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false);
// write 2D Barcode
$pdf->write2DBarcode('X', 'TEST', '', '', 30, 20, $style, 'N');
// NOTE: This is just experimental. 2D barcodes must be implemented on 2dbarcode.php class file.
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_050.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
示例6: array
<tr>
<td style="">总计:¥405.00</td>
<td style="">已收款:¥405.00</td>
<td style="">应收款:¥0.00</td>
<td style="">客户签收:</td>
</tr>
</table>
EOF;
$colophon = <<<EOF
<div style="text-align:center;margin:0;padding:0;font-size:36px;">非常感谢您在步步街 http://www.bubujie.com 购物,我们期待您的再次光临!</div>
EOF;
//============================================================+
// 增加一页
$pdf->AddPage('P', 'A4');
// 附加二维码
$pdf->write2DBarcode('http://www.bubujie.com', 'QRCODE,L', 20, 30, 20, 20, $style, 'N');
// 添加Logo
$pdf->SetXY(13, 10);
$pdf->Image('../images/logo_doc_header.gif', '', '', 72, 16, '', '', '', false, 300, '', false, false, 0, false, false, false);
// 输出正文
$pdf->SetXY(20, 30);
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->SetXY(140, 12);
$pdf->Write(0, '配送单存根联', '', 0, '', true, 0, false, false, 0);
// 输出拔
$pdf->SetXY(20, 130);
$pdf->writeHTML($colophon, true, 0, true, 0);
//============================================================+
$style = array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(0, 0, 0));
$pdf->Line(0, 150, 210, 150, $style);
//============================================================+
示例7: array
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
// Set some content to print
$html = <<<EOD
<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// include 2D barcode class (search for installation path)
$uniqueId = uniqid();
$pdf->write2DBarcode($uniqueId, 'QRCODE,L', 100, 130, 100, 50, null, 'N');
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('example_' . $uniqueId . '.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
示例8: testPdfOutput
public function testPdfOutput()
{
$this->markTestIncomplete('QRCODE uses a random mask which can\'t be set.');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 050');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 050', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// NOTE: 2D barcode algorithms must be implemented on 2dbarcode.php class file.
// set font
$pdf->SetFont('helvetica', '', 11);
// add a page
$pdf->AddPage();
// print a message
$txt = "You can also export 2D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcode directory.\n";
$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
$pdf->SetFont('helvetica', '', 10);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// write RAW 2D Barcode
$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
$pdf->write2DBarcode($code, 'RAW', 80, 30, 30, 20, $style, 'N');
// write RAW2 2D Barcode
$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
$pdf->write2DBarcode($code, 'RAW2', 80, 60, 30, 20, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// QRCODE,L : QR-CODE Low error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', 20, 30, 50, 50, $style, 'N');
$pdf->Text(20, 25, 'QRCODE L');
// QRCODE,M : QR-CODE Medium error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', 20, 90, 50, 50, $style, 'N');
$pdf->Text(20, 85, 'QRCODE M');
// QRCODE,Q : QR-CODE Better error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,Q', 20, 150, 50, 50, $style, 'N');
$pdf->Text(20, 145, 'QRCODE Q');
// QRCODE,H : QR-CODE Best error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 20, 210, 50, 50, $style, 'N');
$pdf->Text(20, 205, 'QRCODE H');
// -------------------------------------------------------------------
// PDF417 (ISO/IEC 15438:2006)
/*
The $type parameter can be simple 'PDF417' or 'PDF417' followed by a
number of comma-separated options:
'PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6'
Possible options are:
a = aspect ratio (width/height);
e = error correction level (0-8);
Macro Control Block options:
t = total number of macro segments;
s = macro segment index (0-99998);
f = file ID;
o0 = File Name (text);
o1 = Segment Count (numeric);
o2 = Time Stamp (numeric);
o3 = Sender (text);
o4 = Addressee (text);
o5 = File Size (numeric);
o6 = Checksum (numeric).
Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional.
To use a comma character ',' on text options, replace it with the character 255: "\xff".
*/
$pdf->write2DBarcode('www.tcpdf.org', 'PDF417', 80, 90, 0, 30, $style, 'N');
$pdf->Text(80, 85, 'PDF417 (ISO/IEC 15438:2006)');
// -------------------------------------------------------------------
// DATAMATRIX (ISO/IEC 16022:2006)
$pdf->write2DBarcode('http://www.tcpdf.org', 'DATAMATRIX', 80, 150, 50, 50, $style, 'N');
$pdf->Text(80, 145, 'DATAMATRIX (ISO/IEC 16022:2006)');
// -------------------------------------------------------------------
// new style
$style = array('border' => 2, 'padding' => 'auto', 'fgcolor' => array(0, 0, 255), 'bgcolor' => array(255, 255, 64));
// QRCODE,H : QR-CODE Best error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 80, 210, 50, 50, $style, 'N');
$pdf->Text(80, 205, 'QRCODE H - COLORED');
// new style
$style = array('border' => false, 'padding' => 0, 'fgcolor' => array(128, 0, 0), 'bgcolor' => false);
// QRCODE,H : QR-CODE Best error correction
//.........这里部分代码省略.........
示例9: showBarcode
public function showBarcode($data, $y)
{
$type = strtoupper($data['barcodetype']);
$height = $data['height'];
$width = $data['width'];
$x = $data['x'];
$y = $data['y'] + $y;
$textposition = $data['textposition'];
$code = $data['code'];
$code = $this->analyse_expression($code);
$modulewidth = $data['modulewidth'];
if ($textposition == "" || $textposition == "none") {
$withtext = false;
} else {
$withtext = true;
}
$style = array('border' => false, 'vpadding' => 'auto', 'hpadding' => 'auto', 'text' => $withtext, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
//[2D barcode section]
//DATAMATRIX
//QRCODE,H or Q or M or L (H=high level correction, L=low level correction)
// -------------------------------------------------------------------
// PDF417 (ISO/IEC 15438:2006)
/*
The $type parameter can be simple 'PDF417' or 'PDF417' followed by a
number of comma-separated options:
'PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6'
Possible options are:
a = aspect ratio (width/height);
e = error correction level (0-8);
Macro Control Block options:
t = total number of macro segments;
s = macro segment index (0-99998);
f = file ID;
o0 = File Name (text);
o1 = Segment Count (numeric);
o2 = Time Stamp (numeric);
o3 = Sender (text);
o4 = Addressee (text);
o5 = File Size (numeric);
o6 = Checksum (numeric).
Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional.
To use a comma character ',' on text options, replace it with the character 255: "\xff".
*/
switch ($type) {
case "PDF417":
$this->pdf->write2DBarcode($code, 'PDF417', $x, $y, $width, $height, $style, 'N');
break;
case "DATAMATRIX":
//$this->pdf->Cell( $width,10,$code);
if (left($code, 3) == "QR:") {
$code = right($code, strlen($code) - 3);
$this->pdf->write2DBarcode($code, 'QRCODE', $x, $y, $width, $height, $style, 'N');
} else {
$this->pdf->write2DBarcode($code, 'DATAMATRIX', $x, $y, $width, $height, $style, 'N');
}
break;
case "CODE128":
$this->pdf->write1DBarcode($code, 'C128', $x, $y, $width, $height, $modulewidth, $style, 'N');
// $this->pdf->write1DBarcode($code, 'C128', $x, $y, $width, $height,"", $style, 'N');
break;
case "EAN8":
$this->pdf->write1DBarcode($code, 'EAN8', $x, $y, $width, $height, $modulewidth, $style, 'N');
break;
case "EAN13":
$this->pdf->write1DBarcode($code, 'EAN13', $x, $y, $width, $height, $modulewidth, $style, 'N');
break;
case "CODE39":
$this->pdf->write1DBarcode($code, 'C39', $x, $y, $width, $height, $modulewidth, $style, 'N');
break;
case "CODE93":
$this->pdf->write1DBarcode($code, 'C93', $x, $y, $width, $height, $modulewidth, $style, 'N');
break;
}
}
示例10: pdf_seven
//.........这里部分代码省略.........
}
$y += 52;
// new row
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Stretching, position and alignment example
$pdf->SetXY(110, 200);
$pdf->Image('examples/images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
$pdf->Image('examples/images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
// -------------------------------------------------------------------
//饼状图
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of PieSector() method.');
$xc = 105;
$yc = 100;
$r = 50;
$pdf->SetFillColor(0, 0, 255);
$pdf->PieSector($xc, $yc, $r, 20, 120, 'FD', false, 0, 2);
$pdf->SetFillColor(0, 255, 0);
$pdf->PieSector($xc, $yc, $r, 120, 250, 'FD', false, 0, 2);
$pdf->SetFillColor(255, 0, 0);
$pdf->PieSector($xc, $yc, $r, 250, 20, 'FD', false, 0, 2);
// write labels
$pdf->Text(105, 65, 'BLUE11');
$pdf->Text(60, 95, 'GREEN');
$pdf->Text(120, 115, 'RED');
//二维码
// add a page
$pdf->AddPage();
// print a message
$txt = "You can also export 2D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcode directory.\n";
$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// write RAW 2D Barcode
$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
$pdf->write2DBarcode($code, 'RAW', 80, 30, 30, 20, $style, 'N');
// write RAW2 2D Barcode
$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
$pdf->write2DBarcode($code, 'RAW2', 80, 60, 30, 20, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// QRCODE,L : QR-CODE Low error correction
$pdf->write2DBarcode('你好!哈哈', 'QRCODE,L', 20, 30, 50, 50, $style, 'N');
$pdf->Text(20, 25, 'QRCODE L');
// QRCODE,M : QR-CODE Medium error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', 20, 90, 50, 50, $style, 'N');
$pdf->Text(20, 85, 'QRCODE M');
// QRCODE,Q : QR-CODE Better error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,Q', 20, 150, 50, 50, $style, 'N');
$pdf->Text(20, 145, 'QRCODE Q');
// QRCODE,H : QR-CODE Best error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 20, 210, 50, 50, $style, 'N');
$pdf->Text(20, 205, 'QRCODE H');
// -------------------------------------------------------------------
// PDF417 (ISO/IEC 15438:2006)
/*
The $type parameter can be simple 'PDF417' or 'PDF417' followed by a
number of comma-separated options:
'PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6'
Possible options are:
a = aspect ratio (width/height);
e = error correction level (0-8);
Macro Control Block options:
t = total number of macro segments;
s = macro segment index (0-99998);
f = file ID;
o0 = File Name (text);
o1 = Segment Count (numeric);
o2 = Time Stamp (numeric);
o3 = Sender (text);
o4 = Addressee (text);
o5 = File Size (numeric);
o6 = Checksum (numeric).
Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional.
To use a comma character ',' on text options, replace it with the character 255: "\xff".
*/
$pdf->write2DBarcode('www.tcpdf.org', 'PDF417', 80, 90, 0, 30, $style, 'N');
$pdf->Text(80, 85, 'PDF417 (ISO/IEC 15438:2006)');
// -------------------------------------------------------------------
// DATAMATRIX (ISO/IEC 16022:2006)
$pdf->write2DBarcode('http://www.tcpdf.org', 'DATAMATRIX', 80, 150, 50, 50, $style, 'N');
$pdf->Text(80, 145, 'DATAMATRIX (ISO/IEC 16022:2006)');
// -------------------------------------------------------------------
// new style
$style = array('border' => 2, 'padding' => 'auto', 'fgcolor' => array(0, 0, 255), 'bgcolor' => array(255, 255, 64));
// QRCODE,H : QR-CODE Best error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 80, 210, 50, 50, $style, 'N');
$pdf->Text(80, 205, 'QRCODE H - COLORED');
// new style
$style = array('border' => false, 'padding' => 0, 'fgcolor' => array(128, 0, 0), 'bgcolor' => false);
// QRCODE,H : QR-CODE Best error correction
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 140, 210, 50, 50, $style, 'N');
$pdf->Text(140, 205, 'QRCODE H - NO PADDING');
//Close and output PDF document
$pdf->Output('example.pdf', 'I');
}
示例11: array
<td align="center" ><strong><font color="#0A296B">Numero Tiquete:</font></strong><br/>{$num_tiquete}</td>
<td align="center" ><strong><font color="#0A296B">Estado Tiquete:</font></strong><br/>{$estado_tiquete}</td>
<td align="center" colspan="2"><strong><font size="12" color="#0A296B"></font></strong><font size="14" color="#FF0000"></font></td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
$pdf->SetFont('helvetica', '', 11);
// print a message
$pdf->SetFont('helvetica', '', 10);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => false, 'vpadding' => 30, 'hpadding' => 30, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 0.6, 'module_height' => 0.6);
$id_tiquete = $_POST["id_tiquete"];
// QRCODE,Q : QR-CODE Better error correction
$pdf->write2DBarcode('http://200.71.38.34/aplicacion5.php?opcion=13&confirmacion=' . $id_tiquete, 'QRCODE,Q', 96, 17, 2900, 40, $style, 'N');
$pdf->SetFont('helvetica', '', 10);
$style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
$doc_pasajero = $_POST["doc_pasajero"];
$pdf->Cell(0, 30, '', 0, 1);
$pdf->write1DBarcode("{$doc_pasajero}{$id_tiquete}", 'MSI+', '160', '28', '', 18, 0.4, $style, 'N');
$pdf->Ln();
//Start Graphic Transformation
$pdf->StartTransform();
// draw jpeg image to be clipped
$pdf->Image('images/home.png', 190, 11, 4, 4, '', 'http://200.71.38.34/html/aplicacion5.php?opcion=6', '', true, 70);
$pdf->Output('tiquete', 'I');
// close and output PDF document
//============================================================+
// END OF FILE
//============================================================+