Example #1
11
 private function printPDF($customer_id, $post_device, $post_user, $comment, $username, $randomcode, $date)
 {
     require_once Mage::getBaseDir('lib') . '/tcpdf/tcpdf.php';
     // create new PDF docume, nt
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // set font
     $pdf->SetFont('helvetica', '', 11);
     // add a page
     $pdf->AddPage();
     $pdf->setJPEGQuality(100);
     // set cell padding
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->SetLineWidth(0.2);
     // set cell margins
     $pdf->setCellMargins(0, 0, 0, 0);
     $pdf->setCellHeightRatio(1);
     // set color for background
     $pdf->SetFillColor(255, 255, 255);
     // Multicell
     // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
     // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(50, 0, 'SERVISNI LIST - REVERS', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->MultiCell(100, 0, 'GAMEBOX, Cara Dušana 47, Niš - tel 018/514-666 - 060/514-666-0', 0, 'L', 1, 0, 80, $pdf->getY() + 1, true, 0, false);
     // Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
     // $pdf->Image(dirname(__FILE__). '/bcimages/'. $randkey . '.png',80,8,100,8,'','','',true);
     $pdf->Image(Mage::getBaseDir('media') . '/pdf/gbr.png', 182, 10, 20, 60, '', '', '', true);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 8);
     $pdf->Cell(70, 6, 'Naziv uredjaja', 0, 0, 'L', 0);
     $pdf->Cell(40, 6, 'Serijski broj', 0, 0, 'L', 0);
     $pdf->Cell(60, 6, 'Opis kvara', 0, 0, 'L', 0);
     $pdf->Ln();
     $i = 1;
     foreach ($post_device as $key => $post) {
         if ($i == 1) {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'LT', 'L', 1, 0, 10, '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 'T', 'L', 1, 0, 80, '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'TR', 'L', 1, 0, 120, '', true, 0, false);
         } else {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'L', 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 0, 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'R', 'L', 1, 0, '', '', true, 0, false);
         }
         $pdf->Ln();
         ++$i;
     }
     //$pdf->MultiCell(70, 15, ' 1. ' . $naziv1, 'LT', 'L', 1, 0, 10, '', true, 0, false);
     //$pdf->MultiCell(40, 15, $_POST['sn1'], 'T', 'L', 1, 0, 80, '', true, 0, false);
     //$pdf->MultiCell(60, 15, $opis1, 'TR', 'L', 1, 0, 120, '', true, 0, false);
     //$pdf->Ln();
     $pdf->MultiCell(70, 1, ' ', 'LB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(40, 1, ' ', 'B', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(60, 1, ' ', 'RB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Dodatna uputstva / komentari', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(170, 5, $comment, 'TRLB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Na servis predao', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Ime:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['name'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Datum i vreme prijema:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $date, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Email:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['email'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Kontrolni kod:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $randomcode, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Telefon:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['phone'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(120, 6, 'Pratite stanje Vašeg uredjaja na servisu.<br>Posetite <b>http://proveraservisa.gamebox.co.rs/</b> i unesite Vaš kontrolni kod<br />ili skenirajte <b>QR</b> kod pomocu Vašeg mobilnog telefona', 0, 'L', 1, 0, 70, '', true, 0, true);
     $pdf->Ln();
     $pdf->Ln(3);
     $pdf->MultiCell(110, 10, "\n" . Mage::getStoreConfig('servisnilist/text/upozorenje'), 1, 'C', 1, 0, 50, '', true, 0, false);
     $pdf->Ln();
     if (count($post_device) == 1) {
         $pdf->Ln();
     }
     $pdf->Ln(5);
     $pdf->Image(Mage::getBaseDir('media') . '/pdf/cut-here.png', 3, '', 250, 3, '', '', '', false, 300, '', false, false, 0, true);
     $pdf->Ln(9);
     $x = $pdf->GetX();
     $y = $pdf->GetY();
     // bottom part
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(50, 8, 'SERVISNI LIST - REVERS', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->MultiCell(100, 0, 'GAMEBOX, Cara Dušana 47, Niš - tel 018/514-666 - 060/514-666-0', 0, 'L', 1, 0, 80, '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 8);
     $pdf->Cell(70, 6, 'Naziv uredjaja', 0, 0, 'L', 0);
     $pdf->Cell(40, 6, 'Serijski broj', 0, 0, 'L', 0);
     $pdf->Cell(60, 6, 'Opis kvara', 0, 0, 'L', 0);
     $pdf->Ln();
     $i = 1;
     foreach ($post_device as $key => $post) {
         if ($i == 1) {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'LT', 'L', 1, 0, 10, '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 'T', 'L', 1, 0, 80, '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'TR', 'L', 1, 0, 120, '', true, 0, false);
         } else {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'L', 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 0, 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'R', 'L', 1, 0, '', '', true, 0, false);
         }
         $pdf->Ln();
         ++$i;
     }
     $pdf->MultiCell(70, 1, ' ', 'LB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(40, 1, ' ', 'B', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(60, 1, ' ', 'RB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Dodatna uputstva / komentari', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(170, 5, $comment, 'TRLB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Obracun', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 6, 'Materijal', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'j. mere', 0, 0, 'L', 0);
     $pdf->Cell(15, 6, 'kolicina', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'cena', 0, 0, 'L', 0);
     $pdf->Cell(25, 6, 'UKUPNO', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(15, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(25, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 6, 'Opis usluge', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'j. mere', 0, 0, 'L', 0);
     $pdf->Cell(15, 6, 'kolicina', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'cena', 0, 0, 'L', 0);
     $pdf->Cell(25, 6, 'UKUPNO', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(15, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(25, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(60, 6, 'SVEGA:', 'B', 'L', 1, 0, 120, $pdf->getY() + 1, true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Na servis predao', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Ime:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['name'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Datum i vreme prijema:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $date, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Email:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['email'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Kontrolni kod:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $randomcode, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Telefon:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['phone'], 0, 'L', 1, 0, 25, '', true, 0, false);
     //$pdf->Image(dirname(__FILE__) . '/bcimages/' . $randkey . '.png', 66, $pdf->getY() - 2, 100, 8, '', '', '', true, 300, '', false, false, 0, false);
     // $pdf->MultiCell(120, 6, 'Pratite stanje Vaseg uredjaja na servisu.<br>Posetite <b>http://bengazi.com/proveraservisa</b> i unesite Vas kontrolni kod' ,0, 'L', 1, 0, 70, '', true, 0, true);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Potpis:', 0, 'L', 1, 0, '', '', true, 0, false);
     // CODE 128 B
     // define barcode style
     $style1d = array('position' => 'S', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => '35', 'vpadding' => '30', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     $pdf->setXY(180, $y + 35);
     //155
     $pdf->StartTransform();
     $pdf->Rotate(90);
     $pdf->write1DBarcode($randomcode, 'C128B', '', '', '', 14, 0.5, $style1d, 'T');
     $pdf->StopTransform();
     // new style
     $styleQR = array('border' => false, 'padding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false);
     // QRCODE,H : QR-CODE Best error correction
     $pdf->write2DBarcode('http://proveraservisa.gamebox.co.rs/?kk=' . $randomcode, 'QRCODE,H', 184, 75, 50, 50, $styleQR, 'N');
     // QRCODE,H : QR-CODE Best error correction
     $pdf->write2DBarcode(Mage::getBaseUrl() . 'servisnilist/status/qr/slid/' . $customer_id, 'QRCODE,H', 184, $y + 65, 50, 50, $styleQR, 'N');
     // Close and output PDF document
     $pdf->IncludeJS('print();');
     // die('y');
     //ob_clean(); //stupid tcpdf need this
     $pdf->Output('trt.pdf', 'I');
     exit;
 }
 /**
  * @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);
 }
$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');
Example #4
0
// ---------------------------------------------------------
// 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');
Example #5
0
$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');
Example #6
0
$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
//============================================================+
Example #7
0
  <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);
//============================================================+
// 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;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</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
//============================================================+
Example #9
0
 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
     $pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 140, 210, 50, 50, $style, 'N');
     $pdf->Text(140, 205, 'QRCODE H - NO PADDING');
     // ---------------------------------------------------------
     $this->comparePdfs($pdf);
 }
Example #10
0
 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;
     }
 }
Example #11
0
/**
 * 图片
 */
function pdf_seven()
{
    require_once 'tcpdf.php';
    // 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 009');
    $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 . ' 009', 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)
    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
        require_once dirname(__FILE__) . '/lang/eng.php';
        $pdf->setLanguageArray($l);
    }
    // -------------------------------------------------------------------
    // add a page
    $pdf->AddPage();
    // set JPEG quality
    $pdf->setJPEGQuality(75);
    // Image method signature:
    // Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // Example of Image from data stream ('PHP rules')
    $imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
    // The '@' character is used to indicate that follows an image data stream and not an image file name
    $pdf->Image('@' . $imgdata);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // Image example with resizing
    $pdf->Image('examples/images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // test fitbox with all alignment combinations
    $horizontal_alignments = array('L', 'C', 'R');
    $vertical_alignments = array('T', 'M', 'B');
    $x = 15;
    $y = 35;
    $w = 30;
    $h = 30;
    // test all combinations of alignments
    for ($i = 0; $i < 3; ++$i) {
        $fitbox = $horizontal_alignments[$i] . ' ';
        $x = 15;
        for ($j = 0; $j < 3; ++$j) {
            $fitbox[1] = $vertical_alignments[$j];
            $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 128));
            $pdf->Image('examples/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
            $x += 32;
            // new column
        }
        $y += 32;
        // new row
    }
    $x = 115;
    $y = 35;
    $w = 25;
    $h = 50;
    for ($i = 0; $i < 3; ++$i) {
        $fitbox = $horizontal_alignments[$i] . ' ';
        $x = 115;
        for ($j = 0; $j < 3; ++$j) {
            $fitbox[1] = $vertical_alignments[$j];
            $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
            $pdf->Image('examples/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
            $x += 27;
            // new column
        }
        $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');
}
Example #12
0
        <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
//============================================================+