function getPdf($image) { require JPATH_SITE . "/components/com_flexpaper/fpdf/fpdf.php"; $filePath = JPATH_SITE . "/components/com_flexpaper/output/certificate.pdf"; $pdf = new FPDF('L', 'mm'); $pdf->SetLeftMargin(0); $pdf->SetRightMargin(0); $pdf->SetTopMargin(0); $pdf->SetAutoPageBreak(false); $pdf->AddPage(); $pdf->Image($image); $pdf_file = $pdf->Output($filePath, 'F'); return $pdf_file; }
function SetRightMargin($margin) { parent::SetRightMargin($margin); $this->_makePageSize(); }
public function drawPDF() { $pdf = new \FPDF('P', 'mm', 'Letter'); if (\COREPOS\Fannie\API\FanniePlugin::isEnabled('CoopDealsSigns')) { $this->font = 'Gill'; $this->alt_font = 'GillBook'; define('FPDF_FONTPATH', dirname(__FILE__) . '/../../../modules/plugins2.0/CoopDealsSigns/noauto/fonts/'); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php'); } $width = 52; // tag width in mm $height = 31; // tag height in mm $left = 6; // left margin $top = 16; // top margin $pdf->SetTopMargin($top); //Set top margin of the page $pdf->SetLeftMargin($left); //Set left margin of the page $pdf->SetRightMargin($left); //Set the right margin of the page $pdf->SetAutoPageBreak(False); // manage page breaks yourself $data = $this->loadItems(); $num = 0; // count tags $x = $left; $y = $top; foreach ($data as $item) { // extract & format data $price = $item['normal_price']; $desc = strtoupper(substr($item['posDescription'], 0, 25)); $brand = ucwords(strtolower(substr($item['brand'], 0, 13))); $pak = $item['units']; $size = $item['units'] . "-" . $item['size']; $sku = $item['sku']; $ppu = $item['pricePerUnit']; $vendor = substr($item['vendor'], 0, 7); $upc = $item['upc']; if ($num % 32 == 0) { $pdf->AddPage(); $x = $left; $y = $top; } else { if ($num % 4 == 0) { $x = $left; $y += $height; } } $pdf->SetFont($this->font, '', 8); $pdf->SetXY($x, $y); // try normal wordwrap // but squeeze into two lines if needed $wrapped = wordwrap($desc, 12, "\n", true); if (count(explode("\n", $wrapped)) > 2) { $wrapped = substr($desc, 0, 12); if ($wrapped[11] != ' ') { $wrapped .= '-'; } $wrapped .= "\n"; $wrapped .= trim(substr($desc, 12)); } $pdf->MultiCell($width / 2, 3, $wrapped, 0, 'L'); $pdf->SetX($x); $pdf->Cell($width / 2, 3, date('n/j/y ') . $size, 0, 1, 'L'); $pdf->SetFont($this->font, 'B', 18); //change font for price $pdf->SetX($x); $pdf->Cell($width / 2, 8, $price, 0, 1, 'L'); $args = array('height' => 7, 'align' => 'L', 'fontsize' => 8, 'width' => 0.23, 'font' => $this->font); $b_y = $pdf->GetY(); $pdf = $this->drawBarcode($upc, $pdf, $x, $b_y, $args); // move right by tag width $x += $width; $num++; } $pdf->Output('Tags4x8P.pdf', 'I'); }
$pfecha = $_SESSION["FECHA"]; } if (isset($_SESSION["TIPO_SOLICITUD"])) { $tipoSolicitud = $_SESSION["TIPO_SOLICITUD"]; } $pdf = new FPDF('P', 'mm', array(215.9, 330.2)); $pdf->AddFont('Calibri', 'B', 'calibrib.php'); $pdf->AddFont('Cambria', 'BI', 'cambriaz.php'); $pdf->AddFont('Cambria', 'I', 'cambriai.php'); $pdf->AddFont('Cambria', 'B', 'cambriab.php'); $pdf->AddFont('Cambria', '', 'Cambria.php'); $pdf->AddPage(); $pdf->SetFont('Arial', '', 18); $pdf->Image($maindir . 'assets/img/Encabezado de documentos.jpg', 4.0, 0.5, 209.6, 32.2, 'JPG'); $pdf->Image($maindir . "assets/img/Pie de documentos.jpg", 4.0, 191, 208.8, 137, 'JPG'); $pdf->SetRightMargin(15); $pdf->SetLeftMargin(15); $pdf->SetFont('Calibri', 'B', 11); $pdf->Cell(0, -4.5, utf8_decode("FACULTAD DE CIENCIAS JURÍDICAS"), 0, 0, 'R'); $pdf->Ln(2); $pdf->SetFont('Arial', '', 10); $pdf->Cell(0, 0, utf8_decode("Teléfono: 2232-2290"), 0, 1, 'R'); $pdf->Ln(4.1); $pdf->Cell(0, 0, utf8_decode("Edificio A-2"), 0, 1, 'R'); $pdf->Ln(4.1); $pdf->Cell(0, 0, utf8_decode("Ciudad Universitaria"), 0, 1, 'R'); $pdf->Ln(4.1); $pdf->Cell(0, 0, utf8_decode("Tegucigalpa, Honduras"), 0, 1, 'R'); $pdf->SetRightMargin(10); $pdf->SetLeftMargin(10); $pdf->Cell(18, 10, '', 0);
function __construct($products, $order, $filename, $save = false) { App::import('vendor', 'fpdf/fpdf'); $orientation = 'P'; $unit = 'pt'; $format = 'A4'; $margin = 40; $pdf = new FPDF($orientation, $unit, $format); App::import('Helper', 'Time'); $timeHelper = new TimeHelper(); setlocale(LC_MONETARY, 'th_TH'); $pdf->AddPage(); $pdf->SetTopMargin($margin); $pdf->SetLeftMargin($margin); $pdf->SetRightMargin($margin); $pdf->SetAutoPageBreak(true, $margin); $pdf->SetY($pdf->GetY() + 60); $pdf->SetFont('Arial', 'B', 10); $pdf->SetTextColor(0); $pdf->SetFillColor(255); $pdf->SetLineWidth(1); $pdf->Cell(50, 25, "Order ID: ", 'LT', 0, 'L'); $pdf->SetFont('Arial', ''); $pdf->Cell(50, 25, $order['Order']['id'], 'T', 0, 'L'); $pdf->SetFont('Arial', 'B'); $pdf->Cell(100, 25, 'Customer Name: ', 'T', 0, 'L'); $pdf->SetFont('Arial', ''); $pdf->Cell(316, 25, $order['User']['name'], 'TR', 1, 'L'); $pdf->SetFont('Arial', 'B'); $pdf->Cell(100, 25, "Delivery Date: ", 'LT', 0, 'L'); $pdf->SetFont('Arial', ''); $pdf->Cell(416, 25, $timeHelper->format($format = 'd-m-Y', $order['Delivery']['date']), 'TR', 1, 'L'); $pdf->SetFont('Arial', 'B', '10'); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 30; $pdf->MultiCell($cell_width, 25, "No.\n ", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $pdf->Cell(250, 25, "Description", 'LTR', 0, 'C'); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 48; $pdf->MultiCell($cell_width, 25, "Number Ordered", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 48; $pdf->MultiCell($cell_width, 25, "Number Supplied", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 70; $pdf->MultiCell($cell_width, 25, "Amount per Unit", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 70; $pdf->MultiCell($cell_width, 25, "Amount\n ", 'LTR', 'C'); $pdf->SetY($pdf->GetY() - 25); $pdf->SetFont('Arial', ''); $pdf->SetFillColor(238); $pdf->SetLineWidth(0.2); $pdf->SetY($pdf->GetY() + 25); $num = 1; $number_ordered = 0; $number_supplied = 0; foreach ($products as $product) { $pdf->Cell(30, 20, $num++, 1, 0, 'L'); $pdf->Cell(250, 20, $product['Product']['short_description'], 1, 0, 'L'); $pdf->Cell(48, 20, $product['LineItem']['quantity'], 1, 0, 'R'); $number_ordered += $product['LineItem']['quantity']; $pdf->Cell(48, 20, $product['LineItem']['quantity_supplied'], 1, 0, 'R'); $number_supplied += $product['LineItem']['quantity_supplied']; $pdf->Cell(70, 20, money_format("%i", $product['Product']['selling_price']), 1, 0, 'R'); $pdf->Cell(70, 20, money_format("%i", $product['LineItem']['total_price_supplied']), 1, 1, 'R'); } $pdf->SetX($pdf->GetX() + 30); $pdf->SetFont('Arial', 'B'); $pdf->Cell(250, 20, "TOTALS", 1); $pdf->SetFont('Arial', ''); $pdf->Cell(48, 20, $number_ordered, 1, 0, 'R'); $pdf->Cell(48, 20, $number_supplied, 1, 0, 'R'); $pdf->Cell(70, 20, "N.A.", 1, 0, 'R'); $pdf->Cell(70, 20, money_format("%i", $order['Order']['total_supplied']), 1, 1, 'R'); $pdf->SetY($pdf->GetY() + 25); $pdf->SetFont('Arial', 'B'); $pdf->Cell(80, 20, "Amount Paid: "); $pdf->SetFont('Arial', ''); $pdf->Cell(80, 20, money_format("%i", $order['Order']['total']), 0, 1); $pdf->SetFont('Arial', 'B'); $pdf->Cell(80, 20, "Actual Amount: "); $pdf->SetFont('Arial', ''); $pdf->Cell(80, 20, money_format("%i", $order['Order']['total_supplied']), 0, 1); $pdf->SetFont('Arial', 'B'); $pdf->Cell(80, 20, "Rebate Amount: "); $pdf->SetFont('Arial', ''); $pdf->Cell(80, 20, money_format("%i", $order['Order']['total'] - $order['Order']['total_supplied']), 0, 1); if ($save) { $pdf->Output($filename, 'F'); } else { $pdf->Output($filename, 'I'); } }
$pdf->SetFont('Arial', 'B', 10); $pdf->Text(50, 50, utf8_decode($titulo)); $pdf->SetXY(20, 52); $pdf->SetFont('Arial', 'B', 8); $pdf->setTextColor(255, 255, 255); $pdf->Cell(50, 6, utf8_decode('FECHA DE PRESENTACIÓN'), 1, 0, 'C', TRUE); $pdf->setTextColor(0, 0, 0); $pdf->Cell(35, 6, $fecha, 1, 0, 'C', FALSE); $pdf->setTextColor(255, 255, 255); $pdf->Cell(50, 6, utf8_decode('HORA DE PRESENTACIÓN'), 1, 0, 'C', TRUE); $pdf->setTextColor(0, 0, 0); $pdf->Cell(35, 6, $time, 1, 0, 'C', FALSE); $pdf->setTextColor(255, 255, 255); $pdf->Rect(20, 60, 110, 30, 'FD'); $pdf->Rect(20, 90, 110, 30, 'FILL'); $pdf->Rect(20, 120, 110, 30, 'FILL'); $pdf->Rect(130, 60, 60, 90, 'FILL'); $pdf->Text(55, 75, utf8_decode('FUNCIONARIO(A) RECEPTOR')); $pdf->setTextColor(0, 0, 0); $pdf->SetFont('Arial', '', 8); $pdf->Text(23, 105, utf8_decode('CÓDIGO DEL FUNCIONARIO: ' . strtoupper($_SESSION['USUARIO']['codigo_usuario']))); $pdf->SetFont('Arial', 'B', 8); $pdf->Text(70, 148, utf8_decode('FIRMA')); $pdf->Text(155, 105, utf8_decode('SELLO')); $pdf->Rect(20, 152, 170, 30, 'FILL'); $pdf->Text(22, 158, utf8_decode('NOTA IMPORTANTE:')); $pdf->SetXY(22, 160); $pdf->SetFont('Arial', '', 8); $pdf->SetRightMargin(27.0); $pdf->MultiCell(0, 4, utf8_decode($mensaje)); $pdf->Output('Denuncia_' . $id_denuncia . '.pdf', 'D');
<?php //require ("fpdf/fpdf.php"); $uid = $this->session->userdata('uid'); if (!$uid) { die("You must login to do that."); } $sid = $this->db->query("SELECT `store` FROM `employees` WHERE `uniq_id` = (SELECT `employee_id` FROM `warnings` WHERE `warning_id` = {$warning_id} LIMIT 0,1)"); $sid = $sid->first_row(); $verified = $this->cpm_functions->verify_access($uid, $sid->store); if ($verified) { $pdf = new FPDF(); $pdf->addFont("barCode39fHR", "", "bar39fh.php"); $pdf->SetRightMargin(160); $pdf->SetTopMargin(118); $pdf->SetAutoPageBreak(TRUE, 62); $pdf->AddPage(); $pdf->addFont("BarCode39fHR", "", "bar39fh.php"); $bottom = $this->cpm_pdflayouts->warning_bottom($warning_id); $information = $this->cpm_pdflayouts->warning_info($warning_id); if ($information !== FALSE && $bottom !== FALSE) { foreach ($information as $val) { switch ($val["type"]) { case "SetRightMargin": $pdf->SetRightMargin($val[0]); break; case "SetTopMargin": $pdf->SetTopMargin($val[0]); break; case "MultiCell": $pdf->MultiCell($val[0], $val[1], $val[2], $val[3], $val[4]);
private function generateJobOrderReportPDF() { /* E_STRICT doesn't like FPDF. */ $errorReporting = error_reporting(); error_reporting($errorReporting & ~E_STRICT); include_once './lib/fpdf/fpdf.php'; error_reporting($errorReporting); // FIXME: Hook? $isASP = $_SESSION['CATS']->isASP(); $unixName = $_SESSION['CATS']->getUnixName(); $siteName = $this->getTrimmedInput('siteName', $_GET); $companyName = $this->getTrimmedInput('companyName', $_GET); $jobOrderName = $this->getTrimmedInput('jobOrderName', $_GET); $periodLine = $this->getTrimmedInput('periodLine', $_GET); $accountManager = $this->getTrimmedInput('accountManager', $_GET); $recruiter = $this->getTrimmedInput('recruiter', $_GET); $notes = $this->getTrimmedInput('notes', $_GET); if (isset($_GET['dataSet'])) { $dataSet = $_GET['dataSet']; $dataSet = explode(',', $dataSet); } else { $dataSet = array(4, 3, 2, 1); } /* PDF Font Face. */ // FIXME: Customizable. $fontFace = 'Arial'; $pdf = new FPDF(); $pdf->AddPage(); if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_PRE'))) { return; } if ($isASP && $unixName == 'cognizo') { /* TODO: MAKE THIS CUSTOMIZABLE FOR EVERYONE. */ $pdf->SetFont($fontFace, 'B', 10); $pdf->Image('images/cognizo-logo.jpg', 130, 10, 59, 20); $pdf->SetXY(129, 27); $pdf->Write(5, 'Information Technology Consulting'); } $pdf->SetXY(25, 35); $pdf->SetFont($fontFace, 'BU', 14); $pdf->Write(5, "Recruiting Summary Report\n"); $pdf->SetFont($fontFace, '', 10); $pdf->SetX(25); $pdf->Write(5, DateUtility::getAdjustedDate('l, F d, Y') . "\n\n\n"); $pdf->SetFont($fontFace, 'B', 10); $pdf->SetX(25); $pdf->Write(5, 'Company: ' . $companyName . "\n"); $pdf->SetFont($fontFace, '', 10); $pdf->SetX(25); $pdf->Write(5, 'Position: ' . $jobOrderName . "\n\n"); $pdf->SetFont($fontFace, '', 10); $pdf->SetX(25); $pdf->Write(5, 'Period: ' . $periodLine . "\n\n"); $pdf->SetFont($fontFace, '', 10); $pdf->SetX(25); $pdf->Write(5, 'Account Manager: ' . $accountManager . "\n"); $pdf->SetFont($fontFace, '', 10); $pdf->SetX(25); $pdf->Write(5, 'Recruiter: ' . $recruiter . "\n"); /* Note that the server is not logged in when getting this file from * itself. */ // FIXME: Pass session cookie in URL? Use cURL and send a cookie? I // really don't like this... There has to be a way. // FIXME: "could not make seekable" - http://demo.catsone.net/index.php?m=graphs&a=jobOrderReportGraph&data=%2C%2C%2C // in /usr/local/www/catsone.net/data/lib/fpdf/fpdf.php on line 1500 $URI = CATSUtility::getAbsoluteURI(CATSUtility::getIndexName() . '?m=graphs&a=jobOrderReportGraph&data=' . urlencode(implode(',', $dataSet))); $pdf->Image($URI, 70, 95, 80, 80, 'jpg'); $pdf->SetXY(25, 180); $pdf->SetFont($fontFace, '', 10); $pdf->Write(5, 'Total Candidates '); $pdf->SetTextColor(255, 0, 0); $pdf->Write(5, 'Screened'); $pdf->SetTextColor(0, 0, 0); $pdf->Write(5, ' by ' . $siteName . ": \n\n"); $pdf->SetX(25); $pdf->SetFont($fontFace, '', 10); $pdf->Write(5, 'Total Candidates '); $pdf->SetTextColor(0, 125, 0); $pdf->Write(5, 'Submitted'); $pdf->SetTextColor(0, 0, 0); $pdf->Write(5, ' to ' . $companyName . ": \n\n"); $pdf->SetX(25); $pdf->SetFont($fontFace, '', 10); $pdf->Write(5, 'Total Candidates '); $pdf->SetTextColor(0, 0, 255); $pdf->Write(5, 'Interviewed'); $pdf->SetTextColor(0, 0, 0); $pdf->Write(5, ' by ' . $companyName . ": \n\n"); $pdf->SetX(25); $pdf->SetFont($fontFace, '', 10); $pdf->Write(5, 'Total Candidates '); $pdf->SetTextColor(255, 75, 0); $pdf->Write(5, 'Placed'); $pdf->SetTextColor(0, 0, 0); $pdf->Write(5, ' at ' . $companyName . ": \n\n\n"); if ($notes != '') { $pdf->SetX(25); $pdf->SetFont($fontFace, '', 10); $pdf->Write(5, "Notes:\n"); $len = strlen($notes); $maxChars = 70; $pdf->SetLeftMargin(25); $pdf->SetRightMargin(25); $pdf->SetX(25); $pdf->Write(5, $notes . "\n"); } $pdf->SetXY(165, 180); $pdf->SetFont($fontFace, 'B', 10); $pdf->Write(5, $dataSet[0] . "\n\n"); $pdf->SetX(165); $pdf->Write(5, $dataSet[1] . "\n\n"); $pdf->SetX(165); $pdf->Write(5, $dataSet[2] . "\n\n"); $pdf->SetX(165); $pdf->Write(5, $dataSet[3] . "\n\n"); $pdf->Rect(3, 6, 204, 285); if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_POST'))) { return; } $pdf->Output(); die; }
$estado = dameEstadoById($id_estado); $direccion = $estado[0]['NOMBRE_ESTADO']; $pdf = new FPDF('P'); $pdf->AddPage(); $pdf->Image('../../public_html/imagenes/logoclaro.png', 40, 60, 120); $pdf->SetTitle("Notificación al denunciante", true); $pdf->Image('../../public_html/imagenes/logoivss.png', 20, 7, 13); $pdf->SetFont('Arial', '', 6); $pdf->Text(40, 10, utf8_decode('REPÚBLICA BOLIVARIANA DE VENEZUELA')); $pdf->Text(40, 13, utf8_decode('MINISTERIO DEL PODER POPULAR PARA EL PROCESO SOCIAL DE TRABAJO')); $pdf->Text(40, 16, utf8_decode('INSTITUTO VENEZOLANO DE LOS SEGUROS SOCIALES')); $pdf->Text(40, 19, utf8_decode('DIRECCIÓN GENERAL DE FISCALIZACIÓN')); $pdf->SetFont('Arial', 'B', 10); #$pdf->Text(20,38,utf8_decode('NOTIFICACIÓN DE CIERRE DE DENUNCIAS, QUEJAS Y/O RECLAMOS PRESENTADA POR AL EMPLEADOR(A) ANTE EL IVSS')); $pdf->setXY(20, 38); $pdf->SetRightMargin(25.0); $pdf->MultiCell(0, 4, utf8_decode('NOTIFICACIÓN DE CIERRE DE QUEJAS Y/O RECLAMOS PRESENTADA POR EL EMPLEADOR(A) ANTE EL IVSS')); $pdf->SetXY(95, 22); $pdf->SetFillColor(35, 65, 129); $pdf->SetFont('Arial', '', 6); $pdf->setTextColor(255, 255, 255); $pdf->Cell(25, 4, utf8_decode('LUGAR'), 1, 0, 'C', true); $pdf->Cell(25, 4, utf8_decode('FECHA'), 1, 0, 'C', true); $pdf->Cell(40, 4, utf8_decode('N° DE QUEJAS Y/O RECLAMOS'), 1, 0, 'C', true); $pdf->Ln(); $pdf->SetXY(95, 26); $pdf->setTextColor(0, 0, 0); $pdf->Cell(25, 6, $direccion, 1, 0, 'C', FALSE); $pdf->Cell(25, 6, $fecha_denuncia, 1, 0, 'C', FALSE); $pdf->Cell(40, 6, $id_denuncia, 1, 0, 'C', FALSE); $pdf->Ln();
//require ('fpdf/fpdf.php'); $term = $this->db->query("SELECT `reason_desc`,`termination_details`,`no_rehire_desc`,`employee_id`,`users`.`first_name` AS `mfname`,`users`.`last_name` AS `mlname`,`employees`.`first_name` AS `efname`,`employees`.`last_name` AS `elname`,`manager_id`,`termination_date`,`last_day_worked`,`separation`,`reason`,`rehire`,`reference_warning`,`scanned`,`status`,`terminations`.`store` FROM\n\t`terminations` JOIN `employees` ON `employee_id` = `uniq_id` JOIN `users` ON `user_id` = `manager_id` JOIN `termination_descriptions` ON `terminations`.`termination_id` = `termination_descriptions`.`termination_id` JOIN `termination_definitions` ON `reason` = `reason_code` WHERE `terminations`.`termination_id` = {$tid}"); $term = $term->first_row(); $sName = $this->db->query("SELECT `store_name` FROM `stores` WHERE `store_id` = {$term->store}")->first_row()->store_name; $employee_name = ucwords(strtolower("{$term->efname} {$term->elname}")); $manager_name = ucwords(strtolower("{$term->mfname} {$term->mlname}")); $rehire = "No"; if ($term->rehire == 1) { $rehire = "Yes"; } elseif ($term->rehire == 2) { $rehire = "Conditionally"; } $pdf = new FPDF(); $pdf->addFont('barCode39fHR', '', 'bar39fh.php'); $pdf->SetRightMargin(160); $pdf->SetTopMargin(118); $pdf->SetAutoPageBreak(TRUE, 62); $pdf->AddPage(); $pdf->setFont('barCode39fHR', '', 24); $pdf->Text(10, 20, "*4-{$tid}*"); $pdf->setFont('Arial', 'B', 18); $pdf->Text(15, 35, 'Voluntary Termination'); $pdf->setFont('Arial', '', 10); $pdf->Text(15, 40, "Employee: {$employee_name} ({$term->employee_id})"); $pdf->Text(15, 45, "Issued by: {$manager_name} ({$term->manager_id}) / {$sName}"); $pdf->Text(15, 55, "Termination Date:\t{$term->termination_date}"); $pdf->Text(15, 60, "Last Day: \t\t\t{$term->last_day_worked}"); $pdf->Text(15, 65, "Reason: {$term->reason_desc}"); $pdf->Text(100, 40, "Would you rehire? {$rehire}"); $pdf->Text(15, 275, "______________________________________________________");
/** * Генерирует PDF-документ на основании XML-файла. * * @param string $file Файл для обработки * @param mixed $replacements массив для подстановки значений * @return FPDF сформированный документ PDF или FALSE в случае неудачи */ public static function xml2pdf($file, $replacements = false) { // Новая обработка PDF require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/odt2pdf.php'; $tpl = basename($file, ".xml") . ".odt"; $t = new odt2pdf($tpl); $t->convert($replacements); return $t; /** * @deprecated */ if (!file_exists($file)) { return false; } require_once dirname(__FILE__) . '/fpdf/fpdf.php'; define('FPDF_FONTPATH', dirname(__FILE__) . '/fpdf/font/'); if (is_array($replacements)) { foreach ($replacements as &$val) { $val = htmlspecialchars_decode($val, ENT_QUOTES); } } $replacements['$tab'] = ' '; $xml = new DOMDocument('1.0', 'windows-1251'); $xml->load($file); $pdf = new FPDF(); // Загружаем шрифты $pdf->AddFont('ArialMT', '', 'c9bb7ceca00657d007d343f4e34b71a8_arial.php'); $pdf->AddFont('Arial-BoldMT', '', '9cb9fc616ba50d7ecc7b816984f2ffda_arialbd.php'); $pdf->AddFont('TimesNewRomanPSMT', '', '5f37f1915715e014ee2254b95c0b6cab_times.php'); $pdf->AddFont('TimesNewRomanPS-BoldMT', '', 'e07f6c05a47ebec50a80f29789c7f1f6_timesbd.php'); /* Загружаем XML-документ и читаем из него основные параметры лоя итогового PDF-документа */ $root = $xml->documentElement; $title = $root->getAttribute('title') ? iconv('windows-1251', 'utf-8', $root->getAttribute('title')) : ''; // заголовок документа $author = $root->getAttribute('author'); // автор $margin_left = $root->getAttribute('margin-left') ? $root->getAttribute('margin-left') : 20; // отступ слева $margin_right = $root->getAttribute('margin-right') ? $root->getAttribute('margin-right') : 20; // отступ справа $margin_top = $root->getAttribute('margin-top') ? $root->getAttribute('margin-top') : 20; // отступ сверху $font_name = $root->getAttribute('font-name') ? $root->getAttribute('font-name') : 'ArialMT'; // дефолтный шрифт (имя) $font_size = (int) $root->getAttribute('font-size') ? (int) $root->getAttribute('font-size') : 10; // дефолтный шрифт (размер) $text_width = (int) $root->getAttribute('width') ? (int) $root->getAttribute('width') : 170; // ширина печатной области документа $paragraph_indent = (int) $root->getAttribute('paragraph-indent') ? (int) $root->getAttribute('paragraph-indent') : 0; // отступ между параграфами $printable = $pdf->h - $margin_top - 20; $pdf->SetTitle($title, true); $pdf->SetAuthor($author); $pdf->SetLeftMargin($margin_left); $pdf->SetRightMargin($margin_right); $pdf->SetTopMargin($margin_top); $pdf->AddPage(); $pdf->SetFont($font_name, '', $font_size); $pdf->SetX($margin_left); $locates = array(); // разбор XML-документа $xpath = new DOMXPath($xml); $scale = $xpath->query('/document/page/*'); if ($scale->length) { $footer = $xpath->query('//footer'); $footer = $footer->length ? $footer->item(0) : NULL; $no_brake = $xpath->query('//nobreak'); $no_brake = $no_brake->length ? TRUE : FALSE; // если есть теги <nobreak>, то расставляем разрывы страниц руками if ($no_brake) { $pdf->SetAutoPageBreak(false); } $last_y = 0; $pages = array(); foreach ($scale as $node) { $last_y = intval($pdf->y); if ($node->tagName == 'nobreak' && $node->getAttribute('start')) { $max_h = $last_y; $loc_offset = 0; foreach ($xpath->query('//cell|locate[(following::nobreak)]') as $i => $nd) { if ($nd->tagName == 'nobreak' && $node->getAttribute('end')) { break; } $_h = $nd->getAttribute('height'); if ($i > 0 && !$loc_offset) { $_h = 0; } $max_h += intval($_h); $loc_offset = $nd->getAttribute('x_offset'); } $max_h += $last_y; if ($max_h > $printable) { if ($footer) { $pdf->SetY(-20); $pdf->SetFont($font_name, '', 9); $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C'); $pages[] = $pdf->PageNo(); } $pdf->AddPage(); } } if ($no_brake && $pdf->y > $printable) { if ($footer && !in_array($pdf->PageNo(), $pages)) { $pdf->SetY(-20); $pdf->SetFont($font_name, '', 9); $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C'); $pages[] = $pdf->PageNo(); } $pdf->AddPage(); } if (!(int) $node->getAttribute('keep-pos')) { $pdf->SetX($margin_left); } // сброс позиции по X-оси если <node keep-pos="0" или не задан if ((int) $node->getAttribute('offset-left')) { $pdf->SetX((int) $node->getAttribute('offset-left') + $margin_left); } if ($node->tagName == 'text') { // вывод строки if ($node->getAttribute('font-name')) { $font_name = $node->getAttribute('font-name'); } if ((int) $node->getAttribute('font-size')) { $font_size = (int) $node->getAttribute('font-size'); } $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'C'; $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width; $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5; $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0; $text = self::prepareNodeText($node, $replacements); if (!($color = $node->getAttribute('color'))) { $color = '000000'; } $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2))); $pdf->SetFont($font_name, '', $font_size); $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0; if ((int) $skip_empty) { if (!trim($text)) { continue; } } $pdf->Cell($width, $height, trim($text), $border, 1, $align); } elseif ($node->tagName == 'paragraph') { // выводит многострочный текстовый блок, можно указывать тип выравнивания текста (L, J, R, C) if (($show_if = $node->getAttribute('show-if')) && !$replacements[$show_if]) { continue; } if ($node->getAttribute('font-name')) { $font_name = $node->getAttribute('font-name'); } if ((int) $node->getAttribute('font-size')) { $font_size = (int) $node->getAttribute('font-size'); } $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J'; $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width; $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5; $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0; $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0; $text = self::prepareNodeText($node, $replacements, $keep_text_wrap); if (!($color = $node->getAttribute('color'))) { $color = '000000'; } $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2))); $pdf->SetFont($font_name, '', $font_size); $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0; if ((int) $skip_empty) { if (!trim($text)) { continue; } } $pdf->MultiCell($width, $height, $text, $border, $align); if ($paragraph_indent) { $pdf->Ln($paragraph_indent); } } elseif ($node->tagName == 'ln') { // перевод строки $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5; $pdf->Ln($height); } elseif ($node->tagName == 'cell') { // рисует ячейку if ($node->getAttribute('font-name')) { $font_name = $node->getAttribute('font-name'); } if ((int) $node->getAttribute('font-size')) { $font_size = (int) $node->getAttribute('font-size'); } $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J'; $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width; $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5; $border = $node->getAttribute('border') != '' ? (int) $node->getAttribute('border') : 1; $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0; $text = self::prepareNodeText($node, $replacements, $keep_text_wrap); if (!($color = $node->getAttribute('color'))) { $color = '000000'; } $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2))); $pdf->SetFont($font_name, '', $font_size); $pdf->Cell($width, $height, $text, $border, 0, $align); } elseif ($node->tagName == 'locate') { // перемещает указатель в определенную позицию в документе $x = $node->getAttribute('x') ? $node->getAttribute('x') : 0; $y = $node->getAttribute('y') ? $node->getAttribute('y') : 0; $x_offset = (int) $node->getAttribute('x_offset') ? (int) $node->getAttribute('x_offset') : 0; $y_offset = (int) $node->getAttribute('y_offset') ? (int) $node->getAttribute('y_offset') : 0; if (strpos($x, '@') !== false) { $x = $locates['x'][$x] + $x_offset; } if (strpos($y, '@') !== false) { $y = $locates['y'][$y] + $y_offset; } if (!$x) { $x = $pdf->GetX() + $x_offset; } if (!$y) { $y = $pdf->GetY() + $y_offset; } $pdf->SetXY($x, $y); } elseif ($node->tagName == 'fix-locate') { // перемещает указатель в определенную позицию в документе if ($x = $node->getAttribute('x')) { $locates['x'][$x] = $pdf->GetX(); } if ($y = $node->getAttribute('y')) { $locates['y'][$y] = $pdf->GetY(); } } elseif ($node->tagName == 'line') { // рисует простую горизонтальную линию $x = (int) $node->getAttribute('x') ? (int) $node->getAttribute('x') : $margin_left; $y = (int) $node->getAttribute('y') ? (int) $node->getAttribute('y') : $margin_top; $len = (int) $node->getAttribute('len') ? (int) $node->getAttribute('len') : $text_width; if ($x) { $pdf->setX($x); } if ($y) { $pdf->setY($y); } $pdf->Cell($len, 0, '', 1); } elseif ($node->tagName == 'newpage') { //новая страница и перевод указателя на нее $pdf->AddPage(); } } } return $pdf; }
// Letter Paper Height in millimeters if (isset($_GET['size'])) { $size = explode('-', $_GET['size']); $Pwidth = is_numeric($size[0]) ? $size[0] : $Pwidth; $Pheight = is_numeric($size[1]) ? $size[1] : $Pheight; } $fontSize = 16; $width = $Pwidth; $height = $Pheight; require $Fpdf_loc; $pdf = new FPDF('P', 'mm', array($width, $height)); $full = isset($_GET['full']); $marginLeft = $full ? 0 : $width / 21.59; $marginTop = $full ? 0 : $height / 13.97; $pdf->SetLeftMargin($marginLeft); $pdf->SetRightMargin($marginLeft); $pdf->SetTopMargin($marginTop / 2); $pdf->SetAutoPageBreak(true, $marginTop); $pages = 0; $files = json_decode($_GET['json']); if ($files == null) { $files = array(); } foreach ($files as $key => $val) { $file = $key; if (is_numeric(strpos($file, "/"))) { $file = substr($file, strrpos($file, "/") + 1); } $file = "Scan_{$file}"; if (!is_file("scans/file/{$file}")) { continue;
} //End Status Message................ if ($attendence >= 50) { $pdf->AddPage(); $pdf->SetFont("Arial", "", "10"); $pdf->Cell(0, 5, "", 0, 1, "C"); $pdf->Cell(0, 0, $pdf->Image("../images/logo1.jpg", $x = null, $y = null, $w = 34, $h = 30, $type = 'jpg', $link = ''), 0, 1, "C"); $pdf->Cell(0, -25, "", 0, 1, "R"); $pdf->SetFont("Arial", "U", "15"); $pdf->Cell(0, 10, "", 0, 1, "C"); $pdf->Cell(0, -23, "", 0, 1, "R"); $pdf->SetLeftMargin("60"); //$pdf->SetLeftMargin("50"); $pdf->Cell(0, 0, $pdf->Image("../images/bg_cert.png", $x = null, $y = null, $w = 140, $h = 45, $type = 'png', $link = ''), 0, 1, "R"); $pdf->Cell(0, -50, "", 0, 1, "R"); $pdf->SetRightMargin("20"); $pdf->SetFont("Arial", "B", "18"); $pdf->SetTextColor("48", "77", "131"); $pdf->Cell(0, 22, "ERP Foundation", 0, 1, "R"); $pdf->SetTextColor("", "", ""); $pdf->SetFont("Arial", "", "10"); $pdf->Cell(0, -7, "", 0, 1, "R"); $pdf->Cell(0, 5, "B-34, First Floor, Shivaji Vihar,", 0, 1, "R"); $pdf->Cell(0, 5, "Rajori Garden, New Delhi - 110027 (INDIA)", 0, 1, "R"); $pdf->Cell(0, 5, "Ph. : 9810504404, 9997088839, 8057665988", 0, 1, "R"); $pdf->SetTextColor("", "", "145"); $pdf->Cell(0, 5, "http://www.erpfoundation.com", 0, 1, "R"); //$email=$row['email']; $pdf->SetFont("Arial", "", "20"); $pdf->SetLeftMargin("20"); $pdf->SetTextColor("", "", "");
public function drawPDF() { $pdf = new \FPDF('P', 'mm', 'Letter'); $width = 52; // tag width in mm $height = 31; // tag height in mm $left = 5.5; // left margin $top = 15; // top margin $pdf->SetTopMargin($top); //Set top margin of the page $pdf->SetLeftMargin($left); //Set left margin of the page $pdf->SetRightMargin($left); //Set the right margin of the page $pdf->SetAutoPageBreak(False); // manage page breaks yourself $data = $this->loadItems(); $num = 0; // count tags $x = $left; $y = $top; foreach ($data as $item) { // extract & format data $price = $item['normal_price']; $desc = strtoupper(substr($item['posDescription'], 0, 27)); $brand = strtoupper(substr($item['brand'], 0, 13)); $pak = $item['units']; $size = $item['units'] . "-" . $item['size']; $sku = $item['sku']; $ppu = $item['pricePerUnit']; $vendor = substr($item['vendor'], 0, 7); $upc = $item['upc']; if ($num % 32 == 0) { $pdf->AddPage(); $x = $left; $y = $top; } else { if ($num % 4 == 0) { $x = $left; $y += $height; } } $args = array('height' => 7, 'valign' => 'T', 'align' => 'L', 'suffix' => date(' n/j/y'), 'fontsize' => 8, 'font' => $this->font); $pdf = $this->drawBarcode($upc, $pdf, $x + 7, $y + 4, $args); $pdf->SetFont($this->font, '', 8); $pdf->SetXY($x, $y + 12); $pdf->Cell($width, 4, $desc, 0, 1, 'L'); $pdf->SetX($x); $pdf->Cell($width, 4, $brand, 0, 1, 'L'); $pdf->SetX($x); $pdf->Cell($width, 4, $size, 0, 1, 'L'); $pdf->SetX($x); $pdf->Cell($width, 4, $sku . ' ' . $vendor, 0, 0, 'L'); if (strstr($ppu, '/') && $ppu[strlen($ppu) - 1] != '/') { $pdf->SetX($x); $pdf->Cell($width - 5, 4, $ppu, 0, 0, 'R'); } $pdf->SetXY($x, $y + 16); $pdf->SetFont($this->font, 'B', 24); //change font size $pdf->Cell($width - 5, 8, $price, 0, 0, 'R'); // move right by tag width $x += $width; $num++; } $pdf->Output('Tags4x8P.pdf', 'I'); }
public function generar_pdf($id_cor, $id_direccion_gen) { $correspondencia = $this->ivss_model->core_parcial($id_cor)->result(); $direccion_general = $this->ivss_model->ver_direccion_general_especifica($id_direccion_gen); foreach ($correspondencia as $cor_item) { $id_cor_oficio = $cor_item->id_cor; $num_control_oficio = $cor_item->num_control; $dir_origen_oficio = $cor_item->dir_origen; $remitente_oficio = $cor_item->remitente; $dir_destino_oficio = $cor_item->dir_destino; $asunto_oficio = $cor_item->asunto; $descripcion_oficio = $cor_item->descripcion; $fecha_crea_oficio = $cor_item->fecha_creacion; } $datos_director = $this->ivss_model->ver_dir_gen_especifica2($dir_destino_oficio)->result(); foreach ($datos_director as $dir) { $nombre_director = $dir->nombre_director; $resolucion_director = $dir->resolucion_director; } $this->load->library('fpdf/fpdf'); $pdf = new FPDF('P'); $pdf->AddPage(); $pdf->SetTitle("correspondencia", true); $pdf->SetFont('Arial', 'B', 16); $pdf->Image($this->config->base_url() . 'fronted/img/banner_institucional.png', 20, 8, 170); $pdf->AliasNbPages(); $pdf->SetSubject("Sistema de correspondencia"); $pdf->Image($this->config->base_url() . 'fronted/img/logogrande.png', 20, 25, 17); $pdf->SetFont('Arial', '', 9); $pdf->Text(68, 30, "REPUBLICA BOLIVARIANA DE VENEZUELA"); $pdf->Text(42, 40, "MINISTERIO DEL PODER POPULAR PARA EL PROCESO SOCIAL DEL TRABAJO"); $pdf->Text(62, 50, "INSTITUTO VENEZOLANO DE LOS SEGUROS SOCIALES"); $pdf->SetLeftMargin(20.0); $pdf->SetRightMargin(20.0); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(20, 70, "OFICIO:"); $pdf->SetFont('Arial', '', 12); $pdf->Text(44, 70, $num_control_oficio); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(20, 80, "PARA:"); $pdf->SetFont('Arial', 'b', 12); #$pdf->Text(44,80,strtoupper(utf8_decode($nombre_director))); $pdf->Text(44, 80, strtoupper(utf8_decode("JACINTO PEREZ BONALDE SANCHEZ"))); $pdf->SetFont('Arial', '', 12); $pdf->Text(44, 90, utf8_decode($dir_destino_oficio)); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(20, 100, "DE:"); $pdf->SetFont('Arial', 'b', 12); $pdf->Text(44, 100, utf8_decode($remitente_oficio)); $pdf->SetFont('Arial', '', 12); $pdf->Text(44, 110, utf8_decode(end(explode("-", $dir_origen_oficio)))); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(20, 120, "FECHA:"); $pdf->SetFont('Arial', '', 12); $pdf->Text(44, 120, $fecha_crea_oficio); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(20, 130, "ASUNTO:"); $pdf->SetFont('Arial', '', 12); $pdf->Text(44, 130, utf8_decode($asunto_oficio)); $pdf->SetXY(10, 140); $pdf->SetFont('Arial', '', 10); $pdf->SetTopMargin(2.0); $pdf->SetLeftMargin(20.0); $pdf->SetRightMargin(20.0); $pdf->MultiCell(0, 7, utf8_decode($descripcion_oficio)); $pdf->SetFont('Arial', 'b', 10); $pdf->Text(93, 245, "Atentamente"); $pdf->Line(50, 264, 160, 264); #$pdf->Image($this->config->base_url().'fronted/img/FIRMADIGITAL.png',52,230,115); $pdf->SetFont('Arial', '', 10); $pdf->Text(75, 268, utf8_decode($remitente_oficio)); $pdf->SetFont('Arial', '', 10); $pdf->Text(88, 272, utf8_decode("Director general")); $pdf->SetFont('Arial', '', 10); $pdf->Text(76, 276, utf8_decode("Según resolución:" . $resolucion_director)); $pdf->Output('oficio_' . $num_control_oficio, 'I'); #tabla /* $cabecera=array('Usuario', 'Total asignados', 'Ejecutados'); $pdf->SetXY(10,30); //Seleccionamos posición $pdf->SetFont('Arial','B',10); //Fuente, Negrita, tamaño foreach($cabecera as $columna){ //Parámetro con valor 2, cabecera vertical $pdf->Cell(50,7, utf8_decode($columna),1, 0,'L'); } $pdf->SetXY(10,31); $pdf->Ln();//Salto de línea para generar otra fila $pdf->Ln();//Salto de línea para generar otra fila foreach($cabecera as $fila){ //Atención!! el parámetro valor 0, hace que sea horizontal $pdf->Cell(50,7, utf8_decode($fila),1, 0 , '' ); } */ #llave clase. }
function __construct($lineItems, $lineItemTotals, $filename, $save = false) { App::import('vendor', 'fpdf/fpdf'); $orientation = 'P'; $unit = 'pt'; $format = 'A4'; $margin = 40; $pdf = new FPDF($orientation, $unit, $format); App::import('Helper', 'Time'); $timeHelper = new TimeHelper(); setlocale(LC_MONETARY, 'th_TH'); $pdf->AddPage(); $pdf->SetTopMargin($margin); $pdf->SetLeftMargin($margin); $pdf->SetRightMargin($margin); $pdf->SetAutoPageBreak(true, $margin); $pdf->SetY($pdf->GetY() + 60); $pdf->SetFont('Arial', 'B', 10); $pdf->SetTextColor(0); $pdf->SetFillColor(255); $pdf->SetLineWidth(1); $pdf->SetFont('Arial', 'B', '10'); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 30; $pdf->MultiCell($cell_width, 25, "No.\n ", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $pdf->Cell(250, 25, "Description", 'LTR', 0, 'C'); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 48; $pdf->MultiCell($cell_width, 25, "# Ordered", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 48; $pdf->MultiCell($cell_width, 25, "# Supplied", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 70; $pdf->MultiCell($cell_width, 25, "Amount Wholesale", 'LTR', 'C'); $pdf->SetXY($current_x + $cell_width, $current_y); $current_y = $pdf->GetY(); $current_x = $pdf->GetX(); $cell_width = 70; $pdf->MultiCell($cell_width, 25, "Amount Retail", 'LTR', 'C'); $pdf->SetY($pdf->GetY() - 25); $pdf->SetFont('Arial', ''); $pdf->SetFillColor(238); $pdf->SetLineWidth(0.2); $pdf->SetY($pdf->GetY() + 25); $num = 1; $number_ordered = 0; $number_supplied = 0; foreach ($lineItems as $lineItem) { $pdf->Cell(30, 20, $num++, 1, 0, 'L'); $pdf->Cell(250, 20, $lineItem['Product']['short_description'], 1, 0, 'L'); $pdf->Cell(48, 20, $lineItem['LineItem']['ordered'], 1, 0, 'R'); $pdf->Cell(48, 20, $lineItem['LineItem']['supplied'], 1, 0, 'R'); $pdf->Cell(70, 20, money_format("%i", $lineItem['LineItem']['amount_wholesale']), 1, 0, 'R'); $pdf->Cell(70, 20, money_format("%i", $lineItem['LineItem']['amount_retail']), 1, 1, 'R'); } $pdf->SetX($pdf->GetX() + 30); $pdf->SetFont('Arial', 'B'); $pdf->Cell(250, 20, "TOTALS", 1); $pdf->SetFont('Arial', ''); $pdf->Cell(48, 20, $lineItemTotals['LineItem']['ordered'], 1, 0, 'R'); $pdf->Cell(48, 20, $lineItemTotals['LineItem']['ordered'], 1, 0, 'R'); $pdf->Cell(70, 20, money_format("%i", $lineItemTotals['LineItem']['amount_wholesale']), 1, 0, 'R'); $pdf->Cell(70, 20, money_format("%i", $lineItemTotals['LineItem']['amount_retail']), 1, 1, 'R'); if ($save) { $pdf->Output($filename, 'F'); } else { $pdf->Output($filename, 'I'); } }
$pdf->setTextColor(0, 0, 0); $pdf->SetFont('Arial', 'B', 8); $pdf->Text(60, 50, utf8_decode('COMPROBANTE DE RECEPCIÓN DE QUEJA Y/O RECLAMO')); $pdf->SetXY(20, 52); $pdf->SetFont('Arial', 'B', 8); $pdf->setTextColor(255, 255, 255); $pdf->Cell(50, 6, utf8_decode('FECHA DE PRESENTACIÓN'), 1, 0, 'C', TRUE); $pdf->Cell(35, 6, '', 1, 0, 'C', FALSE); $pdf->Cell(50, 6, utf8_decode('HORA DE PRESENTACIÓN'), 1, 0, 'C', TRUE); $pdf->Cell(35, 6, '', 1, 0, 'C', FALSE); $pdf->setTextColor(255, 255, 255); $pdf->Rect(20, 60, 110, 30, 'FD'); $pdf->Rect(20, 90, 110, 30, 'FILL'); $pdf->Rect(20, 120, 110, 30, 'FILL'); $pdf->Rect(130, 60, 60, 90, 'FILL'); $pdf->Text(55, 75, utf8_decode('FUNCIONARIO(A) RECEPTOR')); $pdf->setTextColor(0, 0, 0); $pdf->SetFont('Arial', '', 8); $pdf->Text(23, 105, utf8_decode('APELLIDOS Y NOMBRES:')); $pdf->SetFont('Arial', 'B', 8); $pdf->Text(70, 148, utf8_decode('FIRMA')); $pdf->Text(155, 105, utf8_decode('SELLO')); $pdf->Rect(20, 152, 170, 30, 'FILL'); $pdf->Text(22, 158, utf8_decode('NOTA IMPORTANTE:')); $pdf->SetXY(22, 160); $pdf->SetFont('Arial', '', 8); $pdf->SetRightMargin(20.0); $pdf->MultiCell(0, 4, utf8_decode('Procesar su denuncia incolucra a varias unidades administrativas adscritas al IVSS y activa procedimientos necesarios para la solución del problema, por lo cual requiere de un lapso de (60) días para su proceso, es por ello que agradecemos esperar a ser contacctado por vía telefónica o cualquier otro medio para informarle del estatus y/o resultado de su Denuncia, Queja y/o Reclamo.')); /***************************************************************************/ $pdf->Output('comprobante_recepcion_queja.pdf', 'I'); /***************************************************************************/
public function drawPDF() { $pdf = new \FPDF('P', 'mm', 'Letter'); if (\COREPOS\Fannie\API\FanniePlugin::isEnabled('CoopDealsSigns')) { $this->font = 'Gill'; $this->alt_font = 'GillBook'; define('FPDF_FONTPATH', dirname(__FILE__) . '/../../../modules/plugins2.0/CoopDealsSigns/noauto/fonts/'); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php'); } $width = 52; // tag width in mm $bar_width = 50; $height = 31; // tag height in mm $left = 5.5; // left margin $top = 15; // top margin $pdf->SetTopMargin($top); //Set top margin of the page $pdf->SetLeftMargin($left); //Set left margin of the page $pdf->SetRightMargin($left); //Set the right margin of the page $pdf->SetAutoPageBreak(False); // manage page breaks yourself $data = $this->loadItems(); $num = 0; // count tags $x = $left; $y = $top; $sign = 0; foreach ($data as $item) { // extract & format data $price = $item['normal_price']; $desc = $item['description']; $brand = strtoupper($item['brand']); $price = $item['normal_price']; if ($item['scale']) { if (substr($price, 0, 1) != '$') { $price = sprintf('$%.2f', $price); } $price .= ' /lb.'; } else { $price = $this->formatPrice($item['normal_price']); } if ($num % 32 == 0) { $pdf->AddPage(); $x = $left; $y = $top; $sign = 0; } else { if ($num % 4 == 0) { $x = $left; $y += $height; } } $row = floor($sign / 4); $column = $sign % 4; $pdf->SetFillColor(86, 90, 92); $pdf->Rect($left + $width * $column, $top + $row * $height, $bar_width, 5, 'F'); $pdf->Rect($left + $width * $column, $top + $row * $height + 25, $bar_width, 2, 'F'); $pdf->SetXY($left + $width * $column, $top + $row * $height + 6); $pdf->SetFont($this->font, 'B', $this->SMALL_FONT); $pdf->MultiCell($width, 5, $brand, 0, 'C'); $pdf->SetX($left + $width * $column); $pdf->SetFont($this->font, '', $this->MED_FONT); $pdf->MultiCell($width, 5, $item['description'], 0, 'C'); $pdf->SetX($left + $width * $column); $pdf->SetFont($this->font, '', $this->BIG_FONT); $pdf->Cell($width, 8, $price, 0, 1, 'C'); // move right by tag width $x += $width; $num++; $sign++; } $pdf->Output('Tags4x8P.pdf', 'I'); }