123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <?php
- require_once('tcpdf_include.php');
- $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- $pdf->setCreator(PDF_CREATOR);
- $pdf->setAuthor('Nicola Asuni');
- $pdf->setTitle('TCPDF Example 050');
- $pdf->setSubject('TCPDF Tutorial');
- $pdf->setKeywords('TCPDF, PDF, example, test, guide');
- $pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 050', PDF_HEADER_STRING);
- $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
- $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
- $pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
- $pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
- $pdf->setHeaderMargin(PDF_MARGIN_HEADER);
- $pdf->setFooterMargin(PDF_MARGIN_FOOTER);
- $pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
- $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
- if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
- require_once(dirname(__FILE__).'/lang/eng.php');
- $pdf->setLanguageArray($l);
- }
- $pdf->setFont('helvetica', '', 11);
- $pdf->AddPage();
- $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);
- $style = array(
- 'border' => true,
- 'vpadding' => 'auto',
- 'hpadding' => 'auto',
- 'fgcolor' => array(0,0,0),
- 'bgcolor' => false,
- 'module_width' => 1,
- 'module_height' => 1
- );
- $code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
- $pdf->write2DBarcode($code, 'RAW', 80, 30, 30, 20, $style, 'N');
- $code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
- $pdf->write2DBarcode($code, 'RAW2', 80, 60, 30, 20, $style, 'N');
- $style = array(
- 'border' => 2,
- 'vpadding' => 'auto',
- 'hpadding' => 'auto',
- 'fgcolor' => array(0,0,0),
- 'bgcolor' => false,
- 'module_width' => 1,
- 'module_height' => 1
- );
- $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', 20, 30, 50, 50, $style, 'N');
- $pdf->Text(20, 25, 'QRCODE L');
- $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', 20, 90, 50, 50, $style, 'N');
- $pdf->Text(20, 85, 'QRCODE M');
- $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,Q', 20, 150, 50, 50, $style, 'N');
- $pdf->Text(20, 145, 'QRCODE Q');
- $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 20, 210, 50, 50, $style, 'N');
- $pdf->Text(20, 205, 'QRCODE H');
- $pdf->write2DBarcode('www.tcpdf.org', 'PDF417', 80, 90, 0, 30, $style, 'N');
- $pdf->Text(80, 85, 'PDF417 (ISO/IEC 15438:2006)');
- $pdf->write2DBarcode('http://www.tcpdf.org', 'DATAMATRIX', 80, 150, 50, 50, $style, 'N');
- $pdf->Text(80, 145, 'DATAMATRIX (ISO/IEC 16022:2006)');
- $style = array(
- 'border' => 2,
- 'padding' => 'auto',
- 'fgcolor' => array(0,0,255),
- 'bgcolor' => array(255,255,64)
- );
- $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 80, 210, 50, 50, $style, 'N');
- $pdf->Text(80, 205, 'QRCODE H - COLORED');
- $style = array(
- 'border' => false,
- 'padding' => 0,
- 'fgcolor' => array(128,0,0),
- 'bgcolor' => false
- );
- $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 140, 210, 50, 50, $style, 'N');
- $pdf->Text(140, 205, 'QRCODE H - NO PADDING');
- $pdf->Output('example_050.pdf', 'I');
|