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;
 }
 /**
  *   Show miscellaneous information (payment mode, payment term, ...)
  *
  *   @param		TCPDF			$pdf     		Object PDF
  *   @param		Object		$object			Object to show
  *   @param		int			$posy			Y
  *   @param		Translate	$outputlangs	Langs object
  *   @return	void
  */
 function _tableau_info(&$pdf, $object, $posy, $outputlangs)
 {
     global $conf;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     $pdf->SetFont('', '', $default_font_size - 1);
     // If France, show VAT mention if not applicable
     if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) {
         $pdf->SetFont('', 'B', $default_font_size - 2);
         $pdf->SetXY($this->marge_gauche, $posy);
         $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
         $posy = $pdf->GetY() + 4;
     }
     $posxval = 52;
     // Show payments conditions
     if ($object->cond_reglement_code || $object->cond_reglement) {
         $pdf->SetFont('', 'B', $default_font_size - 2);
         $pdf->SetXY($this->marge_gauche, $posy);
         $titre = $outputlangs->transnoentities("PaymentConditions") . ':';
         $pdf->MultiCell(80, 4, $titre, 0, 'L');
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posxval, $posy);
         $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) != 'PaymentCondition' . $object->cond_reglement_code ? $outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
         $lib_condition_paiement = str_replace('\\n', "\n", $lib_condition_paiement);
         $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
         $posy = $pdf->GetY() + 3;
     }
     // Check a payment mode is defined
     /* Not used with orders
     		if (empty($object->mode_reglement_code)
             	&& ! $conf->global->FACTURE_CHQ_NUMBER
             	&& ! $conf->global->FACTURE_RIB_NUMBER)
     		{
                 $pdf->SetXY($this->marge_gauche, $posy);
                 $pdf->SetTextColor(200,0,0);
                 $pdf->SetFont('','B', $default_font_size - 2);
                 $pdf->MultiCell(80, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0);
                 $pdf->SetTextColor(0,0,0);
     
                 $posy=$pdf->GetY()+1;
             }
     		*/
     /* TODO
     		else if (! empty($object->availability_code))
     		{
                 $pdf->SetXY($this->marge_gauche, $posy);
                 $pdf->SetTextColor(200,0,0);
                 $pdf->SetFont('','B', $default_font_size - 2);
                 $pdf->MultiCell(80, 3, $outputlangs->transnoentities("AvailabilityPeriod").': '.,0,'L',0);
                 $pdf->SetTextColor(0,0,0);
     
                 $posy=$pdf->GetY()+1;
     		}*/
     // Show planed date of delivery
     if (!empty($object->date_livraison)) {
         $outputlangs->load("sendings");
         $pdf->SetFont('', 'B', $default_font_size - 2);
         $pdf->SetXY($this->marge_gauche, $posy);
         $titre = $outputlangs->transnoentities("DateDeliveryPlanned") . ':';
         $pdf->MultiCell(80, 4, $titre, 0, 'L');
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posxval, $posy);
         $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
         $pdf->MultiCell(80, 4, $dlp, 0, 'L');
         $posy = $pdf->GetY() + 1;
     } elseif ($object->availability_code || $object->availability) {
         $pdf->SetFont('', 'B', $default_font_size - 2);
         $pdf->SetXY($this->marge_gauche, $posy);
         $titre = $outputlangs->transnoentities("AvailabilityPeriod") . ':';
         $pdf->MultiCell(80, 4, $titre, 0, 'L');
         $pdf->SetTextColor(0, 0, 0);
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posxval, $posy);
         $lib_availability = $outputlangs->transnoentities("AvailabilityType" . $object->availability_code) != 'AvailabilityType' . $object->availability_code ? $outputlangs->transnoentities("AvailabilityType" . $object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '');
         $lib_availability = str_replace('\\n', "\n", $lib_availability);
         $pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
         $posy = $pdf->GetY() + 1;
     }
     // Show payment mode
     if ($object->mode_reglement_code && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') {
         $pdf->SetFont('', 'B', $default_font_size - 2);
         $pdf->SetXY($this->marge_gauche, $posy);
         $titre = $outputlangs->transnoentities("PaymentMode") . ':';
         $pdf->MultiCell(80, 5, $titre, 0, 'L');
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posxval, $posy);
         $lib_mode_reg = $outputlangs->transnoentities("PaymentType" . $object->mode_reglement_code) != 'PaymentType' . $object->mode_reglement_code ? $outputlangs->transnoentities("PaymentType" . $object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
         $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
         $posy = $pdf->GetY() + 2;
     }
     // Show payment mode CHQ
     if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
         // Si mode reglement non force ou si force a CHQ
         if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
             if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
                 $account = new Account($this->db);
                 $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
                 $pdf->SetXY($this->marge_gauche, $posy);
                 $pdf->SetFont('', 'B', $default_font_size - 3);
                 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
                 $posy = $pdf->GetY() + 1;
                 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
                     $pdf->SetXY($this->marge_gauche, $posy);
                     $pdf->SetFont('', '', $default_font_size - 3);
                     $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
                     $posy = $pdf->GetY() + 2;
                 }
             }
             if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
                 $pdf->SetXY($this->marge_gauche, $posy);
                 $pdf->SetFont('', 'B', $default_font_size - 3);
                 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
                 $posy = $pdf->GetY() + 1;
                 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
                     $pdf->SetXY($this->marge_gauche, $posy);
                     $pdf->SetFont('', '', $default_font_size - 3);
                     $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
                     $posy = $pdf->GetY() + 2;
                 }
             }
         }
     }
     // If payment mode not forced or forced to VIR, show payment with BAN
     if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
         if (!empty($object->fk_account) || !empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) {
             $bankid = empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account;
             if (!empty($object->fk_bank)) {
                 $bankid = $object->fk_bank;
             }
             // For backward compatibility when object->fk_account is forced with object->fk_bank
             $account = new Account($this->db);
             $account->fetch($bankid);
             $curx = $this->marge_gauche;
             $cury = $posy;
             $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
             $posy += 2;
         }
     }
     return $posy;
 }
Example #3
0
 protected function getPageRemainingHeight()
 {
     return $this->pdf->getPageHeight() - $this->pdf->GetY() - $this->pdf->getBreakMargin();
 }
Example #4
0
 function printAnnotationSlip($labeldata, $props, $detnotes, $start = 0)
 {
     $numx = $props['numx'];
     $numy = $props['numy'];
     $labelheight = $props['dimensions']['labelheight'];
     $labelwidht = $props['dimensions']['labelwidth'];
     $labelheader_pos = $props['dimensions']['labelheader_pos'];
     $labelbody_pos = $props['dimensions']['labelbody_pos'];
     $numlabels = $numx * $numy;
     set_time_limit(600);
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Niels Klazenga');
     $pdf->SetTitle('MEL Label');
     $pdf->SetSubject('MEL Label');
     //set margins
     $pdf->SetMargins(5, 7.5, 5);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, 3);
     // remove default header/footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('times', '', 8);
     // set cell padding
     $pdf->setCellPaddings(0, 0, 0, 0);
     // set cell margins
     $pdf->setCellMargins(0, 0, 0, 0);
     $labelheader = '<p style="font-weight: bold"><span style="font-size:20px;">NATIONAL HERBARIUM OF VICTORIA (MEL)</span></p>';
     if ($start > 0) {
         $pdf->AddPage();
     }
     for ($i = 0; $i < count($labeldata); $i++) {
         $j = $i + $start;
         $offset = $j % ($numx * $numy);
         $x = $offset % $numx;
         $y = floor($offset / $numx);
         if ($j % $numlabels == 0) {
             $pdf->AddPage();
         }
         $pdf->MultiCell($props['wheader'], 1, $labelheader, 0, 'C', 0, 1, $labelheader_pos['x'][$x], $labelheader_pos['y'][$y], true, false, true);
         $melno = '<p>MEL ';
         $melno .= (int) substr($labeldata[$i]['CatalogNumber'], 0, 7) . substr($labeldata[$i]['CatalogNumber'], 7);
         $melno .= '</p>';
         $pdf->MultiCell($props['whtml'], 5, $melno, 0, 'L', 0, 1, $labelbody_pos['x'][$x], $labelbody_pos['y'][$y] - 1, true, 0, true, true, 0, 'T', false);
         $pdf->MultiCell($props['whtml'], 5, $labeldata[$i]['FormattedName'], 0, 'C', 0, 1, $labelbody_pos['x'][$x], $pdf->GetY(), true, 0, true, true, 0, 'T', false);
         if ($detnotes) {
             $notes = '<p style="line-height:80%">' . $labeldata[$i]['DeterminationNotes'] . '</p>';
             $pdf->MultiCell($props['whtml'], 5, $notes, 0, 'L', 0, 1, $labelbody_pos['x'][$x], $pdf->GetY(), true, 0, true, true, 0, 'T', false);
         }
         if (!$labeldata[$i]['Role']) {
             $labeldata[$i]['Role'] = 'Det.';
         }
         if ($labeldata[$i]['Role'] == 'Acc. name change') {
             $by = 'Accepted name change';
         } else {
             $by = $labeldata[$i]['Role'] . ' ' . $labeldata[$i]['Determiner'];
         }
         $pdf->MultiCell($props['whtml'], 5, $by, 0, 'L', 0, 1, $labelbody_pos['x'][$x], $labelbody_pos['y'][$y] + 15, true, 0, true, true, 0, 'T', false);
         $pdf->MultiCell($props['whtml'], 5, $labeldata[$i]['DeterminedDate'], 0, 'R', 0, 1, $labelbody_pos['x'][$x], $labelbody_pos['y'][$y] + 15, true, 0, true, true, 0, 'T', false);
     }
     $pdf->lastPage();
     $pdf->Output('mellabel.pdf', 'I');
 }
Example #5
0
/**
 * Draws a multichoice question with many options on the TCPDF object.
 * It relies on the current X,Y pointer of the TCPDF context.
 *
 * Generates some metrics about the layout.
 * retuns an object with the following structure:
 * object->coords[]->X
 *                 ->Y
 *                 ->H
 *                 ->W
 *        ->marks[]->X
 *                 ->Y
 *                 ->H
 *                 ->W
 *
 * @param $pdf
 * @param $question
 * @param $columnsWidth
 * @param $ln  Indicates where the current position should go after the call. Possible values are:
 *				0: to the right
 *				1: to the beginning of the next line
 *				2: below
 * @param $markSize
 * @param $fillMarks
 * @param $numcols
 * @param $border draws a border
 * @return object with a coords and marks properties and TCPDF object.
 */
function blended_draw_multichoice_question(TCPDF $pdf, &$dims, $question, $columnsWidth, $ln, $markSize = 3, $fillMarks = false, $numcols = 2, $border = true)
{
    $borderDescription = false;
    $borderOption = false;
    $Xorigin = $pdf->GetX();
    $Yorigin = $pdf->GetY();
    $maxY = 0;
    //$lastH=$pdf->getLastH();
    $setlasH = $pdf->setLastH(1);
    print "Question: {$question->questiontext}</p>";
    //output question
    blended_saveXY($dims, $pdf, $question->id);
    $pdf->writeHTMLCell($columnsWidth, 1, '', '', $question->questiontext, $borderDescription, 0, 0, false);
    blended_saveWH($dims, $pdf, $question->id);
    $pdf->Ln();
    $pdf->SetX($Xorigin);
    $name = $question->id;
    //output options
    $formatoptions = new stdClass();
    $formatoptions->noclean = true;
    $formatoptions->para = false;
    $i = 0;
    //Las marcas se ordenan segun
    if ($question->options->single == 1) {
        $type = 'CIRCLE';
    } else {
        $type = 'SQUARE';
    }
    foreach ($question->anss as $id => $anss) {
        // format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);
        //$option = $anss->answer;
        $option = format_text($anss->answer, FORMAT_MOODLE, $formatoptions);
        //circulo para marcar con un número correlativo a cada respuesta.
        // la marca $i+1 corresponde con la respuesta $id (ver $state)
        // little margin
        $pdf->Cell(1, $markSize, '', 0, 0, 'C', 0, '', '');
        global $letters;
        blended_draw_mark($pdf, $markSize, $dims, $label = $anss->id, $name, $text = $letters[$i], $fillMarks, $type);
        blended_saveXY($dims, $pdf);
        $pdf->writeHTMLCell($columnsWidth / 2 - $markSize - 1, 0, '', '', $option, $borderOption, 0, false);
        blended_saveWH($dims, $pdf);
        $coord = $dims->coords[(int) (count($dims->coords) - 1)];
        $renderedY = $coord->Y + $coord->H;
        $maxY = max($maxY, $renderedY);
        if ($i % $numcols == 1) {
            $pdf->SetY($maxY);
            $pdf->SetX($Xorigin);
        }
        $i++;
    }
    //register global dimensions
    $coord = new stdClass();
    $coord->X = $dims->coords[$question->id]->X;
    $coord->Y = $dims->coords[$question->id]->Y;
    $coord->W = $columnsWidth;
    $a = $dims->coords[count($dims->coords) - 1]->H;
    $b = $dims->coords[count($dims->coords) - 3]->H;
    $maxH = max($a, $b);
    $Yfinal = $pdf->GetY();
    $coord->H2 = $Yfinal - $Yorigin;
    $coord->H = $dims->coords[count($dims->coords) - 1]->Y + $maxH - $coord->Y;
    $dims->coords[$question->id] = $coord;
    switch ($ln) {
        case 0:
            $pdf->SetXY($coord->X + $coord->W, $coord->Y);
            break;
        case 1:
            $margins = $pdf->getMargins();
            $pdf->SetXY($margins['left'], $coord->Y + $coord->H);
            break;
        case 2:
            $pdf->SetXY($coord->X + $coord->W, $coord->Y, $coord->Y + $coord->H);
            break;
    }
    if ($border) {
        $pdf->Rect($coord->X, $coord->Y, $coord->W, $coord->H);
    }
    $pdf->setLastH($coord->H);
}
Example #6
0
     //dc_YDown(1);
     $pdf->SetX($x);
     $pdf->setCellPaddings(0, 0.5, 0, 0.5);
     $pdf->SetFont('dejavusans', 'B', 10, '', true);
     $cx = str_replace(" ", "\n", $b['callnumber']);
     $pdf->MultiCell($lwidth, 0, $cx, 1, 'C', 0, 1, '', '', true);
     //dc_YDown(1);
     if ($k == 0) {
         $lheight += $pdf->getLastH();
     }
 }
 if ($plbcode == 'Y') {
     $pl = true;
     dc_YDown(1);
     $pdf->SetX($x);
     $ty1 = $pdf->GetY();
     $pdf->write1DBarcode($b['barcode'], 'C39', '', '', $lwidth, 9, 0.4, $style, 'N');
     $ty2 = $pdf->GetY();
     //$pdf->Line($x,$ty1,$x+$lwidth,$ty1);
     //$pdf->Line($x,$ty1,$x,$ty2);
     $pdf->Line($x, $ty2, $x + $lwidth, $ty2);
     //$pdf->Line($x+60,$ty1,$x+60,$ty2);
     if ($k == 0) {
         $lheight += 10;
     }
 }
 // End of Print label >>
 if ($pl) {
     if ($k == 0) {
         $k = 1;
         $nrow = floor($dcPageH / $lheight);
Example #7
0
function cetak_infohalaman($label,$info){
	global $pdf;
	$pdf->MultiCell(30, 0, $label, 0, 'L', 0, 0, '', '', true);
	$pdf->MultiCell(100, 0, ': '.$info, 0, 'L', 0, 0, '', '', true);
	$pdf->Ln();
}

function cetak_infohalaman2($label,$info){
	global $pdf,$dcPageW;
	$pdf->MultiCell(30, 0, $label, 0, 'L', 0, 0, $dcPageW-50, '', true);
	$pdf->MultiCell(100, 0, ': '.$info, 0, 'L', 0, 0, '', '', true);
	$pdf->Ln();
}

// 4. Cetak info halaman: Sesuaikan Page Selection Bar >> Edit
$ty=$pdf->GetY();
cetak_infohalaman('Nama stock opname',$data_so['nama']);
cetak_infohalaman('Tanggal mulai',fftgl($data_so['tanggal1']));
cetak_infohalaman('Tanggal selesai',fftgl($data_so['tanggal2']));

if($lap_sum==1){
$pdf->SetY($ty);
cetak_infohalaman2('Total item',$data_so['nitem'].' item');
cetak_infohalaman2('Item dicek',$data_so['nceky'].' item');
cetak_infohalaman2('Item hilang',($data_so['nitem']-$data_so['nceky']).' item');
}
dc_YDown(2);

// 5. Header tabel: samakan di $xtable->head() >> Edit
$phead=array(
array('No.','C',11),
require Yii::getPathOfAlias('webroot') . '/protected/extensions/tcpdf/' . 'tcpdf.php';
// Data loading
$pdf = new TCPDF('P', PDF_UNIT, 'Legal', true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(User::model()->findByPK(Yii::app()->user->name)->emp->Fullname);
$pdf->SetTitle('History Ordinance Report');
// set default header data
$pdf->SetHeaderData('banner.jpg', PDF_HEADER_LOGO_WIDTH, 'Legislative Information System - Provincial Government of La Union v1.0');
// 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(10, $pdf->GetY() + 40, 15);
$pdf->SetHeaderMargin(5);
$pdf->SetFooterMargin(30);
$pdf->SetAutoPageBreak(true, 65);
// set auto page breaks
//$pdf->SetAutoPageBreak(FALSE, 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);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 18);
 public function display($arraydata, $y_axis = 0, $fielddata = false)
 {
     //print_r($arraydata);echo "<br/>";
     //    $this->pdf->Cell(10,10,"SSSS");
     $this->Rotate($arraydata["rotation"]);
     if ($arraydata["rotation"] != "") {
         if ($arraydata["rotation"] == "Left") {
             $w = $arraydata["width"];
             $arraydata["width"] = $arraydata["height"];
             $arraydata["height"] = $w;
             $this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY());
         } elseif ($arraydata["rotation"] == "Right") {
             $w = $arraydata["width"];
             $arraydata["width"] = $arraydata["height"];
             $arraydata["height"] = $w;
             $this->pdf->SetXY($this->pdf->GetX(), $this->pdf->GetY() - $arraydata["height"]);
         } elseif ($arraydata["rotation"] == "UpsideDown") {
             //soverflow"=>$stretchoverflow,"poverflow"
             $arraydata["soverflow"] = true;
             $arraydata["poverflow"] = true;
             //   $w=$arraydata["width"];
             // $arraydata["width"]=$arraydata["height"];
             //$arraydata["height"]=$w;
             $this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY() - $arraydata["height"]);
         }
     }
     if ($arraydata["type"] == "SetFont") {
         if ($arraydata["font"] == 'uGB') {
             $this->pdf->isUnicode = true;
         } else {
             $this->pdf->isUnicode = false;
         }
         $this->pdf->SetFont($arraydata["font"], $arraydata["fontstyle"], $arraydata["fontsize"]);
     } elseif ($arraydata["type"] == "subreport") {
         $this->runSubReport($arraydata);
     } elseif ($arraydata["type"] == "MultiCell") {
         $currenty = $this->pdf->GetY();
         if ($fielddata == false) {
             if ($this->allowprintuntill >= $currenty) {
                 $this->checkoverflow($arraydata, $this->updatePageNo($arraydata["txt"]));
             }
         } elseif ($fielddata == true) {
             if ($this->allowprintuntill >= $currenty) {
                 $this->checkoverflow($arraydata, $this->updatePageNo($this->analyse_expression($arraydata["txt"], $arraydata["isPrintRepeatedValues"])));
             } elseif ($this->parentcurrentband == "detail") {
                 $this->pdf->Cell(40, 10, "SADSD");
             }
             //                  echo $arraydata["txt"]."+\"|(".$y_axis.",".print_r($arraydata,true)."),$this->allowprintuntill,$newy\"<br/><br/>";
         }
     } elseif ($arraydata["type"] == "SetXY") {
         $this->pdf->SetXY($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis);
     } elseif ($arraydata["type"] == "Cell") {
         $currenty = $this->pdf->GetY();
         if ($this->allowprintuntill >= $currenty) {
             $this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->updatePageNo($arraydata["txt"]), $arraydata["border"], $arraydata["ln"], $arraydata["align"], $arraydata["fill"], $arraydata["link"]);
         } elseif ($this->parentcurrentband == "detail") {
             $this->pdf->Cell(40, 10, "SADSD");
         }
     } elseif ($arraydata["type"] == "Rect") {
         $this->pdf->Rect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
     } elseif ($arraydata["type"] == "Image") {
         $path = $this->analyse_expression($arraydata["path"]);
         $imgtype = substr($path, -3);
         if ($imgtype == 'jpg' || right($path, 3) == 'jpg' || right($path, 4) == 'jpeg') {
             $imgtype = "JPEG";
         } elseif ($imgtype == 'png' || $imgtype == 'PNG') {
             $imgtype = "PNG";
         }
         if (file_exists($path) || left($path, 4) == 'http') {
             $this->pdf->Image($path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
         } elseif (left($path, 22) == "data:image/jpeg;base64") {
             $imgtype = "JPEG";
             $img = str_replace('data:image/jpeg;base64,', '', $path);
             $imgdata = base64_decode($img);
             $this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
             //,$imgtype,$arraydata["link"]);
         } elseif (left($path, 22) == "data:image/png;base64,") {
             $imgtype = "PNG";
             // $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
             $img = str_replace('data:image/png;base64,', '', $path);
             $imgdata = base64_decode($img);
             $this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
             //,$imgtype,$arraydata["link"]);
         }
     } elseif ($arraydata["type"] == "SetTextColor") {
         $this->pdf->SetTextColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "SetDrawColor") {
         $this->pdf->SetDrawColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "SetLineWidth") {
         $this->pdf->SetLineWidth($arraydata["width"]);
     } elseif ($arraydata["type"] == "Line") {
         $this->pdf->Line($arraydata["x1"] + $this->arrayPageSetting["leftMargin"], $arraydata["y1"] + $y_axis, $arraydata["x2"] + $this->arrayPageSetting["leftMargin"], $arraydata["y2"] + $y_axis);
     } elseif ($arraydata["type"] == "SetFillColor") {
         $this->pdf->SetFillColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "lineChart") {
         $this->showLineChart($arraydata, $y_axis);
     } elseif ($arraydata["type"] == "barChart") {
         $this->showBarChart($arraydata, $y_axis, 'barChart');
     } elseif ($arraydata["type"] == "stackedBarChart") {
         $this->showBarChart($arraydata, $y_axis, 'stackedBarChart');
     } elseif ($arraydata["type"] == "stackedAreaChart") {
         $this->showAreaChart($arraydata, $y_axis, $arraydata["type"]);
     } elseif ($arraydata["type"] == "Barcode") {
         $this->showBarcode($arraydata, $y_axis);
     }
 }
Example #10
0
$fil .= $fstatus == "0" ? "" : " `status`='{$fstatus}'";
$filt .= $fil;
$fil .= $flevel == "0" ? "" : " `level`='{$flevel}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$fil .= $fgroup == "0" ? "" : " `group`='{$fgroup}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$fil .= $fgroup == "0" ? "" : " `division`='{$fdivision}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$filt = $filt == "" ? "" : " WHERE " . $filt;
$ord = gets('sortby');
$sql = "SELECT * FROM employee " . $filt . " ORDER BY " . $ord;
//echo $sql;
$t = mysql_query($sql);
while ($f = dbFA($t)) {
    $i = 0;
    if ($pdf->GetY() > 190) {
        $pdf->AddPage();
        dc_tableHead($th, $tw);
    }
    if ($tc[dp_Name] == '1') {
        $pdf->MultiCell($tw[$i++], 0, $f['name'], 0, 'L', 0, 0, '', '', true);
    }
    if ($tc[dp_Nip] == '1') {
        $pdf->MultiCell($tw[$i++], 0, $f['nip'], 0, 'L', 0, 0, '', '', true);
    }
    if ($tc[dp_Status] == '1') {
        $pdf->MultiCell($tw[$i++], 0, $mstr_status[$f['status']], 0, 'L', 0, 0, '', '', true);
    }
    if ($tc[dp_Level] == '1') {
        $pdf->MultiCell($tw[$i++], 0, $mstr_level[$f['level']], 0, 'L', 0, 0, '', '', true);
    }
Example #11
0
 /**
  * Add a row
  *
  * @param array|object $row row data
  * @param int $index row index
  * @return TcTable
  */
 private function addRow($row, $index = null)
 {
     $this->copyDefaultColumnDefinitions($row, $index);
     if ($this->trigger(self::EV_ROW_ADD, [$row, $index]) === false) {
         return $this;
     }
     $h = current($this->rowDefinition)['height'];
     $page_break_trigger = $this->pdf->getPageHeight() - $this->pdf->getBreakMargin();
     if ($this->pdf->GetY() + $h >= $page_break_trigger) {
         if ($this->trigger(self::EV_PAGE_ADD, [$row, $index, false]) !== false) {
             $this->pdf->AddPage();
             $this->trigger(self::EV_PAGE_ADDED, [$row, $index, false]);
         }
     }
     foreach ($this->columnDefinition as $key => $value) {
         if (isset($this->rowDefinition[$key])) {
             $this->addCell($key, isset($row[$key]) ? $row[$key] : '', $row);
         }
     }
     $this->trigger(self::EV_ROW_ADDED, [$row, $index]);
     return $this;
 }
Example #12
0
 $pdf->setCellPaddings(1, 1, 1, 1);
 $pdf->SetTextColor(255);
 $pdf->SetFillColor(0);
 for ($i = 0; $i < count($thx); $i++) {
     $pdf->MultiCell($twx[$i], 0, $thx[$i], 1, $tax[$i], 1, 0, '', '', true);
 }
 $pdf->Ln();
 $pdf->SetTextColor(0);
 // End of table head
 // Table body formatting
 $pdf->SetFont('dejavusans', '', 8, '', true);
 $pdf->setCellPaddings(1, 1, 1, 1);
 $row = 1;
 while ($r = dbFA($t)) {
     $i = 0;
     if ($pdf->GetY() > 180) {
         $pdf->AddPage();
         // Table head
         $pdf->SetTextColor(255);
         $pdf->SetFillColor(0);
         for ($i = 0; $i < count($thx); $i++) {
             $pdf->MultiCell($twx[$i], 0, $thx[$i], 1, $tax[$i], 1, 0, '', '', true);
         }
         $pdf->Ln();
         $pdf->SetTextColor(0);
         // End of table head
         //dc_YDown(2);
     }
     // Row data:
     $y = mysql_query("SELECT * FROM catalog WHERE dcid='" . $r['catalog'] . "' LIMIT 0,1");
     $f = mysql_fetch_array($y);
 public function pruebapdfAction()
 {
     // Include the main TCPDF library (search for installation path).
     require_once 'tcpdf/examples/tcpdf_include.php';
     ob_clean();
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 001');
     $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 . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128));
     $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
     // 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);
     }
     // ---------------------------------------------------------
     // set default font subsetting mode
     $pdf->setFontSubsetting(true);
     // Set font
     // dejavusans is a UTF-8 Unicode font, if you only need to
     // print standard ASCII chars, you can use core fonts like
     // helvetica or times to reduce file size.
     $pdf->SetFont('helvetica', '', 9, '', true);
     // Add a page
     // This method has several options, check the source code documentation for more information.
     $pdf->AddPage();
     $pdf->SetFillColor(224, 235, 255);
     $pdf->SetTextColor(0);
     $pdf->SetFont('');
     $fill = 0;
     $pdf->Cell(10, 6, 'Nro', 1, 0, 'L', $fill);
     $pdf->Cell(30, 6, 'Ubicación', 1, 0, 'L', $fill);
     $pdf->Cell(30, 6, 'Sector', 1, 0, 'R', $fill);
     $pdf->Cell(30, 6, 'Fecha', 1, 0, 'R', $fill);
     $pdf->Cell(90, 6, 'Descripción', 1, 0, 'R', $fill);
     $pdf->Ln();
     $sum = 0;
     $sw = 0;
     for ($i = 1; $i < 100; $i++) {
         $maxnocells = 0;
         $cellcount = 0;
         //write text first
         $startX = $pdf->GetX();
         $startY = $pdf->GetY();
         //draw cells and record maximum cellcount
         //cell height is 6 and width is 80
         $cellcount = $pdf->MultiCell(10, 6, $i, 0, 'L', 0, 0);
         if ($cellcount > $maxnocells) {
             $maxnocells = $cellcount;
         }
         $cellcount = $pdf->MultiCell(30, 6, 'Cochabamba', 0, 'L', 0, 0);
         if ($cellcount > $maxnocells) {
             $maxnocells = $cellcount;
         }
         $cellcount = $pdf->MultiCell(30, 6, 'Sector', 0, 'L', 0, 0);
         if ($cellcount > $maxnocells) {
             $maxnocells = $cellcount;
         }
         $cellcount = $pdf->MultiCell(30, 6, 'Sector', 0, 'L', 0, 0);
         if ($cellcount > $maxnocells) {
             $maxnocells = $cellcount;
         }
         $cellcount = $pdf->MultiCell(90, 6, ' fjalañsdklfjalskd ', 0, 'L', 0, 0);
         if ($cellcount > $maxnocells) {
             $maxnocells = $cellcount;
         }
         $pdf->SetXY($startX, $startY);
         //now do borders and fill
         //cell height is 6 times the max number of cells
         $pdf->MultiCell(10, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
         $pdf->MultiCell(30, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
         $pdf->MultiCell(30, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
         $pdf->MultiCell(30, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
         $pdf->MultiCell(90, $maxnocells * 5, '', 'LRB', 'L', $sw, 0);
         $pdf->Ln();
         $sw = !$sw;
         $sum += $maxnocells;
         if ($sum > 42) {
             $pdf->AddPage();
             $sum = 0;
         }
     }
     // ---------------------------------------------------------
     // Close and output PDF document
     // This method has several options, check the source code documentation for more information.
     // $pdf->Output('example_001.pdf', 'I');
     $pdf->Output('/var/www/html/comercializacion/public/file/example_001.pdf', 'F');
     exit;
     //============================================================+
     // END OF FILE
     //============================================================+
     // $this->view->disable();
 }
Example #14
0
 public function checkoverflow($arraydata, $txt = "", $maxheight = 0)
 {
     $newfont = $this->recommendFont($txt, $arraydata["font"], $arraydata["pdfFontName"]);
     $this->pdf->SetFont($newfont, $this->pdf->getFontStyle(), $this->pdf->getFontSize());
     $this->print_expression($arraydata);
     if ($this->print_expression_result == true) {
         // echo $arraydata["link"];
         if ($arraydata["link"]) {
             //print_r($arraydata);
             //$this->debughyperlink=true;
             //  echo $arraydata["link"].",print:".$this->print_expression_result;
             $arraydata["link"] = $this->analyse_expression($arraydata["link"], "");
             //$this->debughyperlink=false;
         }
         //print_r($arraydata);
         if ($arraydata["writeHTML"] == 1 && $this->pdflib == "TCPDF") {
             $this->pdf->writeHTML($txt);
             $this->pdf->Ln();
             if ($this->currentband == 'detail') {
                 if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
                     $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                 } else {
                     if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
                         $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                     }
                 }
             }
         } elseif ($arraydata["poverflow"] == "false" && $arraydata["soverflow"] == "false") {
             if ($arraydata["valign"] == "M") {
                 $arraydata["valign"] = "C";
             }
             if ($arraydata["valign"] == "") {
                 $arraydata["valign"] = "T";
             }
             while ($this->pdf->GetStringWidth($txt) > $arraydata["width"]) {
                 if ($txt != $this->pdf->getAliasNbPages() && $txt != ' ' . $this->pdf->getAliasNbPages()) {
                     $txt = substr_replace($txt, "", -1);
                 }
             }
             $x = $this->pdf->GetX();
             $y = $this->pdf->GetY();
             $text = $this->formatText($txt, $arraydata["pattern"]);
             $this->pdf->Cell($arraydata["width"], $arraydata["height"], $text, $arraydata["border"], "", $arraydata["align"], $arraydata["fill"], $arraydata["link"], 0, true, "T", $arraydata["valign"]);
             //                if($arraydata["link"]) { //
             //                    $tmpalign="Left";
             //                    if($arraydata["valign"]=="R")
             //                        $tmpalign="Right";
             //                    elseif($arraydata["valign"]=="C")
             //                        $tmpalign="Center";
             //                    $textlen=strlen($text);
             //                    $hidetxt="";
             //                    for($l=0;$l<$textlen*2;$l++)
             //                    $hidetxt.="&nbsp;";
             //                              $imagehtml='<a style="text-decoration: none;" href="'.$arraydata["link"].'">'.
             //                                      '<div style="text-decoration: none;text-align:$tmpalign;float:left;width:'.$arraydata["width"].';margin:0px">'.$hidetxt.'</div></a>';
             //                         //     $this->pdf->writeHTMLCell($arraydata["width"],$arraydata["height"], $x,$y-$arraydata["height"],$imagehtml);//,1,0,true);
             //                }
             //
             $this->pdf->Ln();
             if ($this->currentband == 'detail') {
                 if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
                     $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                 } else {
                     if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
                         $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                     }
                 }
             }
         } elseif ($arraydata["soverflow"] == "true") {
             if ($arraydata["valign"] == "C") {
                 $arraydata["valign"] = "M";
             }
             if ($arraydata["valign"] == "") {
                 $arraydata["valign"] = "T";
             }
             if ($maxheight == 0) {
                 $maxheight = $this->pdf->getNumLines($txt, $arraydata["width"]) * ($this->pdf->GetFontSize() * $this->pdf->getCellHeightRatio() + 2 * 1);
                 $maxheight = max($maxheight, $arraydata["height"]);
                 //FIXED para poder alinear verticalmente
             }
             $x = $this->pdf->GetX();
             //if($arraydata["link"])   echo $arraydata["linktarget"].",".$arraydata["link"]."<br/><br/>";
             $this->pdf->MultiCell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], $arraydata["align"], $arraydata["fill"], 1, '', '', true, 0, false, true, $maxheight, $arraydata["valign"]);
             //,$arraydata["valign"]);
             if ($this->pdf->balancetext == '' && $this->currentband == 'detail') {
                 if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
                     $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                 } else {
                     if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
                         $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                     }
                 }
             }
             //$this->pageFooter();
             if ($this->pdf->balancetext != '') {
                 $this->continuenextpageText = array('width' => $arraydata["width"], 'height' => $arraydata["height"], 'txt' => $this->pdf->balancetext, 'border' => $arraydata["border"], 'align' => $arraydata["align"], 'fill' => $arraydata["fill"], 'ln' => 1, 'x' => $x, 'y' => '', 'reset' => true, 'streth' => 0, 'ishtml' => false, 'autopadding' => true);
                 $this->pdf->balancetext = '';
                 $this->forcetextcolor_b = $this->textcolor_b;
                 $this->forcetextcolor_g = $this->textcolor_g;
                 $this->forcetextcolor_r = $this->textcolor_r;
                 $this->forcefillcolor_b = $this->fillcolor_b;
                 $this->forcefillcolor_g = $this->fillcolor_g;
                 $this->forcefillcolor_r = $this->fillcolor_r;
                 if ($this->continuenextpageText) {
                     $this->printlongtext($this->pdf->getFontFamily(), $this->pdf->getFontStyle(), $this->pdf->getFontSize());
                 }
             }
         } elseif ($arraydata["poverflow"] == "true") {
             if ($arraydata["valign"] == "M") {
                 $arraydata["valign"] = "C";
             }
             if ($arraydata["valign"] == "") {
                 $arraydata["valign"] = "T";
             }
             $this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], "", $arraydata["align"], $arraydata["fill"], $arraydata["link"] . "", 0, true, "T", $arraydata["valign"]);
             $this->pdf->Ln();
             if ($this->currentband == 'detail') {
                 if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
                     $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                 } else {
                     if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
                         $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                     }
                 }
             }
         } else {
             //MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0) {
             $this->pdf->MultiCell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], $arraydata["align"], $arraydata["fill"], 1, '', '', true, 0, true, true, $maxheight);
             if ($this->pdf->balancetext == '' && $this->currentband == 'detail') {
                 if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
                     $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                 } else {
                     if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
                         $this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
                     }
                 }
             }
             if ($this->pdf->balancetext != '') {
                 $this->continuenextpageText = array('width' => $arraydata["width"], 'height' => $arraydata["height"], 'txt' => $this->pdf->balancetext, 'border' => $arraydata["border"], 'align' => $arraydata["align"], 'fill' => $arraydata["fill"], 'ln' => 1, 'x' => $x, 'y' => '', 'reset' => true, 'streth' => 0, 'ishtml' => false, 'autopadding' => true);
                 $this->pdf->balancetext = '';
                 $this->forcetextcolor_b = $this->textcolor_b;
                 $this->forcetextcolor_g = $this->textcolor_g;
                 $this->forcetextcolor_r = $this->textcolor_r;
                 $this->forcefillcolor_b = $this->fillcolor_b;
                 $this->forcefillcolor_g = $this->fillcolor_g;
                 $this->forcefillcolor_r = $this->fillcolor_r;
                 $this->gotTextOverPage = true;
                 if ($this->continuenextpageText) {
                     $this->printlongtext($this->pdf->getFontFamily(), $this->pdf->getFontStyle(), $this->pdf->getFontSize());
                 }
             }
         }
     }
     $this->print_expression_result = false;
 }
Example #15
0
$fil .= $fauthor == "0" || $fauthor == "" ? "" : " `author`='{$fauthor}'";
$filt .= $fil;
$fil .= $fpublisher == "0" || $fpublisher == "" ? "" : " `publisher`='{$fpublisher}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$fil .= $flanguage == "0" || $flanguage == "" ? "" : " `language`='{$flanguage}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$filt = $filt == "" ? "" : " WHERE " . $filt;
$ord = gets('sortby');
$ord = $ord == "" ? "" : " ORDER BY " . $ord;
$sql = "SELECT * FROM `catalog` " . $filt . $ord;
//echo $sql;
$pdf->setCellPaddings(1, 1, 1, 1);
$t = mysql_query($sql);
while ($f = dbFA($t)) {
    $i = 0;
    if ($pdf->GetY() > 190) {
        $pdf->AddPage();
        dc_tableHead($th, $tw, $ta);
    }
    $ny = $pdf->GetY();
    $my = 0;
    if ($tc[dp_Title] == '1') {
        $pdf->MultiCell($tw[$i++], 0, str_replace("\\'", "'", $f['title']), 0, 'L', 0, 0, '', '', true);
    }
    if ($pdf->getLastH() > $my) {
        $my = $pdf->getLastH();
    }
    if ($tc[dp_Callnumber] == '1') {
        $pdf->MultiCell($tw[$i++], 0, $f['callnumber'], 0, 'L', 0, 0, '', '', true);
    }
    if ($pdf->getLastH() > $my) {
Example #16
0
 public function add_table($table)
 {
     $absolute_position = $this->is_absolute($table);
     if (!$absolute_position) {
         $this->validate_position($table->ancho);
     }
     if ($table->fondo) {
         $this->choose_color();
     }
     $this->SetLineWidth(0.3);
     // set the width of the table
     $margins = parent::getMargins();
     if ($table->ancho == 0) {
         if (parent::GetX() == $margins['left']) {
             $table->ancho = $this->document_width;
         } elseif (isset($table->x)) {
             $table->ancho = $this->document_width - $table->x;
         } else {
             $table->ancho = $this->document_width - $this->last_width;
         }
     }
     // get the widths of the headers
     $encabezados = (array) $table->encabezados;
     $string_widths = 0;
     $has_superheaders = false;
     foreach ($encabezados as $key => $cell) {
         if (is_array($cell)) {
             $has_superheaders = true;
             foreach ($cell as $value) {
                 $string_widths += parent::GetStringWidth($value);
             }
         } else {
             $string_widths += parent::GetStringWidth($cell);
         }
     }
     if ($table->borde == 0) {
         $header_border = 'B';
         $data_border = 0;
     } else {
         $header_border = 1;
         $data_border = 'LR';
     }
     // print headers
     $x = parent::GetX();
     $y = parent::GetY();
     $widths = array();
     $i = 0;
     if ($has_superheaders) {
         $cell_h = 26;
     } else {
         $cell_h = 13;
     }
     foreach ($encabezados as $index => $cell) {
         if (is_array($cell)) {
             $super_w = 0;
             $super_x = parent::GetX();
             foreach ($cell as $key => $value) {
                 array_push($widths, $this->GetStringWidth($value) / $string_widths * $table->ancho);
                 parent::WriteHTMLCell($widths[$i + $key], $cell_h / 2, parent::GetX(), $y + $cell_h / 2, "<b>" . $value . "</b>", $header_border, 0, $table->fondo, true, 'C');
                 $super_w += $widths[$i + $key];
             }
             parent::WriteHTMLCell($super_w, $cell_h / 2, $super_x, $y, "<b>" . $index . "</b>", $header_border, 0, $table->fondo, true, 'C');
             parent::SetXY(parent::GetX(), $y + $cell_h / 2);
         } else {
             array_push($widths, $this->GetStringWidth($cell) / $string_widths * $table->ancho);
             parent::WriteHTMLCell($widths[$index], $cell_h, parent::GetX(), $y, "<b>" . $cell . "</b>", $header_border, 0, $table->fondo, true, 'C');
         }
         $i++;
     }
     parent::Ln();
     parent::SetX($x);
     // print data
     $fill = false;
     foreach ($table->datos as $row) {
         foreach ($row as $i => $field) {
             $this->WriteHTMLCell($widths[$i], 6, '', '', $field, $data_border, 0, $fill, true, 'L', true);
         }
         if (parent::GetY() + 20 > parent::getPageHeight() - PDF_MARGIN_BOTTOM) {
             parent::AddPage();
         }
         $height = parent::getLastH();
         $this->Ln();
         if ($table->fondo) {
             $fill = !$fill;
         }
     }
     $this->Cell(array_sum($widths), 0, '', 'T', $table->salto);
     // set document positions
     parent::SetXY(parent::GetX() + $this->separator, parent::GetY());
     if ($absolute_position) {
         $this->last_width = parent::GetX();
     }
     $y = parent::GetY();
     if ($y > $this->last_height) {
         $this->last_height = $y;
     }
 }
Example #17
0
	$pdf->MultiCell($lwidth, 0, $desc, 'LBR', 'C', 0, 9, '', '', true);
	if($k==0) $lheight+=$pdf->getLastH();	
	}
	if($plcnum=='1'){ $pl=true;
	//dc_YDown(1);
	$pdf->SetX($x);
	$pdf->setCellPaddings(0,0.5,0,0.5);
	$pdf->SetFont('dejavusans', 'B', 10, '', true);
	$cx=str_replace(" ","\n",preg_replace("/\s+/"," ",$b['callnumber']));
	$pdf->MultiCell($lwidth, 0, $cx, 1, 'C', 0, 1, '', '', true);
	//dc_YDown(1);
	if($k==0) $lheight+=$pdf->getLastH();
	}
	if($plbcode=='1'){ $pl=true;
	dc_YDown(1);
	$pdf->SetX($x); $ty1=$pdf->GetY(); 
	$pdf->write1DBarcode($b['barkode'], 'C39', '', '', $lwidth, 9, 0.4, $style, 'N');
	$ty2=$pdf->GetY(); 
	//$pdf->Line($x,$ty1,$x+$lwidth,$ty1);
	//$pdf->Line($x,$ty1,$x,$ty2);
	$pdf->Line($x,$ty2,$x+$lwidth,$ty2);
	//$pdf->Line($x+60,$ty1,$x+60,$ty2);
	if($k==0) $lheight+=10;
	}
	// End of Print label >>
	
	if($pl){
	if($k==0){
		$k=1;
		$nrow=floor($dcPageH/$lheight);
	}
Example #18
0
    function loanPaperWorkPDF()
    {
        $this->loan->LoanNumber = $this->loaninfo['LoanNumber'];
        $this->Address();
        $this->LoanAgentString();
        $this->preptypes = array('Sheet' => 'sheet', 'Packet' => 'packet', 'Microscope slide' => 'microscope slide', 'Spirit' => 'spirit jar', 'Cibachrome' => 'cibachrome', 'Photograph of specimen' => 'photograph', 'Type' => 'type');
        $this->LoanSummaryString();
        $this->loanPrepHeader = array('LoanNumber' => $this->loan->LoanNumber, 'LoanAgent' => $this->LoanAgents, 'ShipmentDate' => $this->loaninfo['ShipmentDate'], 'LoanPrepSummary' => $this->LoanSummaryString());
        $pdf = new TCPDF();
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Niels Klazenga');
        $pdf->SetTitle('MEL Label');
        $pdf->SetSubject('MEL Label');
        //set margins
        $pdf->SetMargins(25, 37, 25);
        //set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, 15);
        // remove default header/footer
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->setViewerPreferences(array('FitWindow' => true));
        // set font
        $pdf->SetFont('helvetica', '', 10);
        // set cell padding
        $pdf->setCellPaddings(0, 0, 0, 0);
        // set cell margins
        $pdf->setCellMargins(0, 0, 0, 0);
        // start loan cover letter
        $pdf->AddPage();
        $image_file = base_url() . 'images/loans_paperwork_background.png';
        $pdf->Image($image_file, 163, 0, 30, 0, 'PNG', '', 'T', true, 300, '', false, false, 0, false, false, false);
        $pdf->MultiCell(120, 5, $this->loaninfo['ShipmentDate'], 0, 'L', 0, 1, 25, 15, true, false, true);
        $pdf->MultiCell(120, 5, $this->loan->ShippedTo, 0, 'L', 0, 1, 25, 22, true, false, true);
        $pdf->MultiCell(125, 5, '<span style="font-size:16pt;font-weight:bold">MEL loan ' . $this->loan->LoanNumber . '</span>', 0, 'L', 0, 1, 25, 65, true, false, true);
        $pdf->MultiCell(130, 1, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
        $w = 30;
        $y = $pdf->GetY() - 2;
        $pdf->MultiCell($w, 5, 'For study by:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(120 - $w, 5, $this->LoanAgents, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell($w, 5, 'Description:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $description = $this->loaninfo['Description'];
        if (strpos($description, '||')) {
            $description = substr($description, 0, strpos($description, '||'));
        }
        $description = trim($description);
        $pdf->MultiCell(120 - $w, 5, $description, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell($w, 5, 'Quantity:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(120 - $w, 5, $this->Quantity(), 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell($w, 5, 'Due date:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(120 - $w, 5, $this->loaninfo['CurrentDueDate'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell($w, 5, 'Shipment details:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(120 - $w, 5, $this->loaninfo['ShipmentMethod'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        if ($this->loaninfo['TrackingLabels']) {
            $y = $pdf->GetY() + 1;
            $pdf->MultiCell($w, 5, 'Tracking label(s):', 0, 'L', 0, 1, 25, $y, true, false, true);
            $pdf->MultiCell(120 - $w, 5, $this->loaninfo['TrackingLabels'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        }
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell($w, 5, 'Loan conditions:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(120 - $w, 5, 'See attached. ' . $this->loaninfo['SpecialConditions'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        $pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
        $paragraphs = array();
        $paragraphs[] = <<<EOD
Please verify the contents of the loan against the attached specimen list and acknowledge
receipt by returning the yellow copy of this form. Any damage in transit should be noted
on the yellow form.
EOD;
        $paragraphs[] = <<<EOD
This loan should be returned to MEL by the date shown above. An extension may be granted
on request.
EOD;
        if (strstr($this->LoanAgents, ' and ')) {
            $c = 'comply';
        } else {
            $c = 'complies';
        }
        $paragraphs[] = <<<EOD
Please ensure that {$this->LoanAgents} {$c} with the enclosed loan conditions.
EOD;
        $paragraphs[] = <<<EOD
Electronic data for the specimens in this loan is available on request. For queries relating
to loans, exchange or donations, please email MEL at herbmel@rbg.vic.gov.au.
EOD;
        foreach ($paragraphs as $para) {
            $pdf->Multicell(125, 5, $para, 0, 'J', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
        }
        $pdf->MultiCell(125, 5, $this->loaninfo['ShippedBy'] . ' on behalf of the Collections Manager', 0, 'L', 0, 1, 25, $pdf->GetY() + 8, true, false, true);
        $y = 231;
        //$image_file = base_url() . 'images/scissors.png';
        //$pdf->Image($image_file, 22, $y-2.5, 5, 5, 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
        //$pdf->MultiCell(127, 5, '<hr/>', 0, 'L', 0, 1, 25.5, $y, true, false, true);
        $pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $y, true, false, true);
        $y = $pdf->GetY() - 1;
        $pdf->MultiCell(45, 5, 'Number of parcels: ' . $this->loaninfo['NumberOfPackages'], 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(75, 5, 'Number of specimens: ' . $this->Quantity(), 0, 'L', 0, 1, 75, $y, true, false, true);
        $pdf->MultiCell(125, 5, 'Material received in good condition.', 0, 'L', 0, 1, 25, $pdf->GetY() + 3, true, false, true);
        $y = $pdf->GetY() + 3;
        $pdf->MultiCell(25, 5, 'Comments: ', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(105, 5, '<hr/>', 0, 'L', 0, 1, 45, $y + 4, true, false, true);
        $pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
        $pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell(35, 5, 'Receiving officer:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(60, 5, '<hr/>', 0, 'L', 0, 1, 53, $y + 4, true, false, true);
        $pdf->MultiCell(15, 5, 'Date: ', 0, 'L', 0, 1, 115, $y, true, false, true);
        $pdf->MultiCell(25, 5, '<hr/>', 0, 'L', 0, 1, 125, $y + 4, true, false, true);
        $pdf->setY(0);
        $x = 165;
        $pdf->SetFont('helvetica', '', 7);
        $letterh = <<<EOD
        <div style="color:#999999">National Herbarium of Victoria (MEL)<br />Birdwood Avenue<br />
            South Yarra<br />
            Victoria 3141<br />
            Australia
        </div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, 60, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">CITES<br />AU 026</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Telephone<br />(03) 9252 2300</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Facsimile<br />(03) 9252 2413</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Email<br />herbmel@rbg.vic.gov.au</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Web<br/ >www.rbg.vic.gov.au/science</div>
EOD;
        $pdf->MultiCell(31, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">The Royal Botanic Gardens Board (Victoria)</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 111, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Patron<br />Dame Elisabeth Murdoch</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Incorporating:</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 5, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Royal Botanic Gardens Melbourne</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">National Herbarium of Victoria</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Royal Botanic Gardens Cranbourne</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        $letterh = <<<EOD
        <div style="color:#999999">Australian Research Centre for Urban Ecology</div>
EOD;
        $pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
        // move pointer to last page
        $pdf->lastPage();
        // ---------------------------------------------------------
        //Close and output PDF document
        $pdf->Output('loan.pdf', 'I');
    }
Example #19
0
 function Add_Label($text_head, $text, $padding = 3, $bordercolor = 230, $img = "", $imwidth = 0, $imheight = 0, $headerfontsize = 6, $fontsize = 6, $idfontsize = 7, $barcode = "", $bar_w = "0.4", $bar_h = "20", $barcodesize = 20, $raligntext = 0)
 {
     $this->_COUNTX++;
     if ($this->_COUNTX == $this->_X_Number) {
         // Row full, we start a new one
         $this->_COUNTX = 0;
         $this->_COUNTY++;
         if ($this->_COUNTY == $this->_Y_Number) {
             // End of page reached, we start a new one
             $this->_COUNTY = 0;
             $this->AddPage();
         }
     }
     //$_PosX = $this->_Margin_Left + $this->_COUNTX*($this->_Width+$this->_X_Space) + $this->_Padding;
     //$_PosY = $this->_Margin_Top + $this->_COUNTY*($this->_Height+$this->_Y_Space) + $this->_Padding;
     $_PosX = $this->_Margin_Left + $this->_COUNTX * ($this->_Width + $this->_X_Space);
     $_PosY = $this->_Margin_Top + $this->_COUNTY * ($this->_Height + $this->_Y_Space);
     //$this->SetXY($_PosX, $_PosY);
     //sivann:
     if (strlen($img)) {
         $this->Image($img, $_PosX + $padding, $_PosY + $padding, $imwidth, 0);
         $imwidth += 1;
         //dont glue it with text
         $imheight += 1;
     }
     //draw text
     //header
     $this->SetTextColor(0, 70, 100);
     $this->Set_Font_Size($headerfontsize);
     $this->SetXY($_PosX + $imwidth + $padding, $_PosY + $padding);
     //$this->MultiCell($this->_Width-$imwidth-(2*$padding), $this->_Line_Height, $text_head);
     $this->MultiCell($this->_Width - $imwidth - 2 * $padding, $this->_Line_Height, $text_head, 0, 'L');
     if (strstr($text, "ID:")) {
         $txtid = $text;
         $txtid = str_replace("\n", "", $txtid);
         $txtid = preg_replace('/.*ID:([0-9]+).*/', 'ID:\\1 ', $txtid);
         $text = preg_replace('/ID:[0-9]+\\n/', '', $text);
         $this->SetFont('freesans', 'B');
         $this->SetTextColor(0, 0, 0);
         $this->Set_Font_Size($idfontsize);
         if (!$raligntext) {
             if ($this->y - $_PosY >= $imheight) {
                 //if header text had more height than the image
                 $this->SetX($_PosX);
                 //position to the left border, we are now under the logo hopefully
             } else {
                 $this->SetXY($_PosX, $_PosY + $imheight);
             }
             $this->MultiCell($this->_Width - 2 * $padding, $this->_Line_Height, "{$txtid}", 0, 'L');
         }
     }
     if (strlen($barcode)) {
         $Y = parent::GetY();
         $qz = $bar_w * 10;
         //quiet zone
         //$X=$_PosX+$padding+$qz; //force quiet zone on the left
         $X = $_PosX;
         //quite zone on the left
         $bstyle = array('position' => '', 'align' => 'L', 'stretch' => false, 'fitwidth' => false, 'cellfitalign' => '', 'border' => false, 'hpadding' => 10 * $bar_w, 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 9, 'stretchtext' => 1);
         //code,type,x,y, width,height, xres, style, align
         //$this->write1DBarcode($barcode, 'C39E+', $X, $Y, $this->_Width, $bar_h, $bar_w, $bstyle, 'N');
         //$this->write1DBarcode($barcode, 'C128', $X, $Y, $this->_Width, $bar_h, $bar_w, $bstyle, 'N');
         // QRCODE,M : QR-CODE Medium error correction
         $this->write2DBarcode($barcode, 'QRCODE,M', $X, $Y, $barcodesize, $barcodesize, $bstyle, 'N');
         //		  $this->write2DBarcode('www.lala.org', 'QRCODE,M', $X, $Y, $barcodesize,$barcodesize, $bstyle, 'N');
     }
     //rest of the text
     if ($raligntext) {
         //$this->SetXY($_PosX+$barcodesize-2, $Y+$qz-3);
         $this->SetFont('freesans', 'B');
         $this->SetXY($_PosX + $barcodesize, $Y + $qz);
         $this->MultiCell($this->_Width - 2 * $padding, $this->_Line_Height, $txtid, 0, 'L');
         $this->SetX($_PosX + $barcodesize);
         //position to the left border, we are now under the logo image hopefully
     } else {
         $this->SetX($_PosX);
         //position to the left border, we are now under the logo image hopefully
     }
     $this->SetFont('freesans');
     $this->SetTextColor(0, 0, 0);
     $this->Set_Font_Size($fontsize);
     $this->MultiCell($this->_Width - 2 * $padding, $this->_Line_Height, $text, 0, 'L');
     if ($bordercolor) {
         $this->SetDrawColor($bordercolor, $bordercolor, $bordercolor);
     }
     //horz borders (sivann):
     $this->Line($_PosX, $_PosY, $_PosX + $this->_Width, $_PosY);
     $this->Line($_PosX, $_PosY + $this->_Height, $_PosX + $this->_Width, $_PosY + $this->_Height);
     //sivann: vertical borders:
     $this->Line($_PosX, $_PosY, $_PosX, $_PosY + $this->_Height);
     $this->Line($_PosX + $this->_Width, $_PosY, $_PosX + $this->_Width, $_PosY + $this->_Height);
 }
Example #20
0
/**
 * Function to try to calculate height of a HTML Content
 * 
 * @param TCPDF     $pdf            PDF initialized object
 * @param string    $htmlcontent    HTML Contect
 * @see getStringHeight
 */
function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
{
    // store current object
    $pdf->startTransaction();
    // store starting values
    $start_y = $pdf->GetY();
    //var_dump($start_y);
    $start_page = $pdf->getPage();
    // call printing functions with content
    $pdf->writeHTMLCell(0, 0, 0, $start_y, $htmlcontent, 0, 1, false, true, 'J', true);
    // get the new Y
    $end_y = $pdf->GetY();
    $end_page = $pdf->getPage();
    // calculate height
    $height = 0;
    if ($end_page == $start_page) {
        $height = $end_y - $start_y;
    } else {
        for ($page = $start_page; $page <= $end_page; ++$page) {
            $this->setPage($page);
            if ($page == $start_page) {
                // first page
                $height = $this->h - $start_y - $this->bMargin;
            } elseif ($page == $end_page) {
                // last page
                $height = $end_y - $this->tMargin;
            } else {
                $height = $this->h - $this->tMargin - $this->bMargin;
            }
        }
    }
    // restore previous object
    $pdf = $pdf->rollbackTransaction();
    return $height;
}
Example #21
0
    function exchangePaperWorkPDF()
    {
        $this->loan->GiftNumber = $this->loaninfo['GiftNumber'];
        $this->Address();
        $this->LoanAgentString();
        $this->preptypes = array('Duplicate' => 'duplicate', 'Seed duplicate' => 'seed duplicate', 'Silica gel sample' => 'silica gel sample', 'Shipping material' => 'shipping material', 'Type' => 'type');
        $this->exchangeSummaryString();
        $this->loanPrepHeader = array('ExchangeNumber' => $this->loan->GiftNumber, 'LoanAgent' => $this->LoanAgents, 'ShipmentDate' => $this->loaninfo['ShipmentDate'], 'LoanPrepSummary' => $this->exchangeSummaryString());
        $pdf = new TCPDF();
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Niels Klazenga');
        $pdf->SetTitle('MEL Label');
        $pdf->SetSubject('MEL Label');
        //set margins
        $pdf->SetMargins(25, 37, 25);
        //set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, 15);
        // remove default header/footer
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->setViewerPreferences(array('FitWindow' => true));
        // set font
        $pdf->SetFont('helvetica', '', 10);
        // set cell padding
        $pdf->setCellPaddings(0, 0, 0, 0);
        // set cell margins
        $pdf->setCellMargins(0, 0, 0, 0);
        // start loan cover letter
        $pdf->AddPage();
        $pdf->Image('images/mel-letterhead.jpg', 25, 0, '', '', '', '', 'T', true, 300, '', false, false, 0, false, false, false);
        $pdf->MultiCell(120, 5, $this->loaninfo['ShipmentDate'], 0, 'L', 0, 1, 25, 15, true, false, true);
        $pdf->MultiCell(120, 5, $this->loan->ShippedTo, 0, 'L', 0, 1, 25, 22, true, false, true);
        $pdf->MultiCell(130, 5, '<span style="font-size:16pt;font-weight:bold">MEL ' . $this->loaninfo['ExchangeType'] . ' to ' . $this->loaninfo['Acronym'] . ' (MEL ref.' . $this->loan->GiftNumber . ')</span>', 0, 'L', 0, 1, 25, 65, true, false, true);
        $pdf->MultiCell(130, 1, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
        $w = 30;
        $y = $pdf->GetY() - 2;
        if ($this->loaninfo['GiftAgents']) {
            $pdf->MultiCell($w, 5, 'Attention:', 0, 'L', 0, 1, 25, $y, true, false, true);
            $pdf->MultiCell(130 - $w, 5, $this->loaninfo['GiftAgents'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
            $y = $pdf->GetY() + 1;
        }
        $pdf->MultiCell($w, 5, 'Description:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $description = $this->loaninfo['Description'];
        if (strpos($description, '||')) {
            $description = substr($description, 0, strpos($description, '||'));
        }
        $description = trim($description);
        $pdf->MultiCell(120 - $w, 5, $description, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell($w, 5, 'Quantity:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(120 - $w, 5, $this->Quantity(), 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        if ($this->loaninfo['ExchangeType'] != 'shipping material') {
            $y = $pdf->GetY() + 1;
            $pdf->MultiCell($w, 5, 'Electronic data:', 0, 'L', 0, 1, 25, $y, true, false, true);
            if ($this->LoanAgents) {
                $when = $this->loaninfo['ShipmentDate'];
                $what = $this->loaninfo['ExchangeFileName'];
                $text = $what . ' emailed to ' . $this->LoanAgents;
            } else {
                $text = 'Available on request';
            }
            $pdf->MultiCell(120 - $w, 5, $text, 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        }
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell($w, 5, 'Shipment details:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(120 - $w, 5, $this->loaninfo['ShipmentMethod'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        if ($this->loaninfo['TrackingLabels']) {
            $y = $pdf->GetY() + 1;
            $pdf->MultiCell($w, 5, 'Tracking label(s):', 0, 'L', 0, 1, 25, $y, true, false, true);
            $pdf->MultiCell(120 - $w, 5, $this->loaninfo['TrackingLabels'], 0, 'L', 0, 1, 30 + $w, $y, true, false, true);
        }
        $pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $pdf->GetY() + 1, true, false, true);
        $paragraphs = array();
        $paragraphs[] = <<<EOD
Please verify the contents of this consignment against the attached specimen list and acknowledge
receipt by returning the yellow copy of this form.
EOD;
        $paragraphs[] = <<<EOD
For queries relating to loans, exchange or donations, please email MEL at herbmel@rbg.vic.gov.au.
EOD;
        foreach ($paragraphs as $para) {
            $pdf->Multicell(125, 5, $para, 0, 'J', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
        }
        $pdf->MultiCell(125, 5, $this->loaninfo['ShippedBy'] . ' on behalf of the Collections Manager', 0, 'L', 0, 1, 25, $pdf->GetY() + 8, true, false, true);
        $y = 231;
        $pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $y, true, false, true);
        $y = $pdf->GetY() - 1;
        $pdf->MultiCell(45, 5, 'Number of parcels: ' . $this->loaninfo['NumberOfPackages'], 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(75, 5, 'Number of specimens: ' . $this->Quantity(), 0, 'L', 0, 1, 75, $y, true, false, true);
        $pdf->MultiCell(125, 5, 'Material received in good condition.', 0, 'L', 0, 1, 25, $pdf->GetY() + 3, true, false, true);
        $y = $pdf->GetY() + 3;
        $pdf->MultiCell(25, 5, 'Comments: ', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(105, 5, '<hr/>', 0, 'L', 0, 1, 45, $y + 4, true, false, true);
        $pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
        $pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
        $y = $pdf->GetY() + 1;
        $pdf->MultiCell(35, 5, 'Receiving officer:', 0, 'L', 0, 1, 25, $y, true, false, true);
        $pdf->MultiCell(60, 5, '<hr/>', 0, 'L', 0, 1, 53, $y + 4, true, false, true);
        $pdf->MultiCell(15, 5, 'Date: ', 0, 'L', 0, 1, 115, $y, true, false, true);
        $pdf->MultiCell(25, 5, '<hr/>', 0, 'L', 0, 1, 125, $y + 4, true, false, true);
        $pdf->Output('exchange.pdf', 'I');
    }
// Data loading
$pdf = new TCPDF('L', PDF_UNIT, 'Legal', true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(User::model()->findByPK(Yii::app()->user->name)->emp->Fullname);
$pdf->SetTitle('Yearly Resolution Report for FY ' . $start_year . ' - ' . $end_year);
$pdf->Ln(20);
// set default header data
$pdf->SetHeaderData('banner.jpg', PDF_HEADER_LOGO_WIDTH, 'Legislative Information System - Provincial Government of La Union v1.0');
// 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(15, $pdf->GetY() + 50, 15);
$pdf->SetHeaderMargin(10);
$pdf->SetFooterMargin(30);
$pdf->SetAutoPageBreak(true, 65);
// set auto page breaks
//$pdf->SetAutoPageBreak(FALSE, 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);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 15);
Example #23
0
 // Queries:
 $t = dbSel("*", "employee", "W/`dcid`='{$dcid}' LIMIT 0,1");
 $ndata = mysql_num_rows($t);
 $r = dbFA($t);
 // add a page
 $pdf->AddPage();
 // Title : Comprehensive Report **
 $pdf->SetFont('dejavusans', 'B', 12, '', true);
 $pdf->MultiCell($dcPageW, 0, 'Comprehensive Report', 0, 'C', 0, 1, '', '', true);
 dc_YDown(5);
 // Name **
 $pdf->SetFont('dejavusans', 'B', 13, '', true);
 $txt = $r['name'];
 $pdf->MultiCell($dcPageW, 0, $txt, 0, 'C', 0, 1, '', '', true);
 $pdf->Ln();
 $cy = $pdf->GetY();
 if ($dps[dp_Employeedata] == '1') {
     // Photo **
     $rimg = dbFetch("photo", "emp_photo", "W/`empid`='{$dcid}'");
     if (!empty($rimg)) {
         $imgdata = base64_decode($rimg);
         $pdf->Image('@' . $imgdata);
     } else {
         $pdf->Image('images/nophoto.png');
     }
     // Employee Data **
     $pdf->SetFont('dejavusans', '', 9, '', true);
     dc_EmployeeData('NIP', $r['nip']);
     dc_EmployeeData('Level', $mstr_level[$r['level']]);
     dc_EmployeeData('Division', $mstr_division[$r['division']]);
     dc_EmployeeData('Group', $mstr_group[$r['group']]);