public function drawPDF() { $pdf = new \FPDF('L', 'mm', 'Letter'); $pdf->SetMargins(3.175, 3.175, 3.175); $pdf->SetAutoPageBreak(false); 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->SetFont($this->font, '', 16); $data = $this->loadItems(); $width = 136.52; $height = 105; $top = 90; $left = 15; $effective_width = $width - 2 * $left; foreach ($data as $item) { $pdf->AddPage(); $column = 1; // right aligned $price = $this->printablePrice($item); $pdf->SetXY($left + $width * $column, $top); $pdf->SetFontSize($this->SMALL_FONT); $pdf->Cell($effective_width, 10, $item['brand'], 0, 1, 'C'); $pdf->SetX($left + $width * $column); $pdf->SetFontSize($this->MED_FONT); $pdf->MultiCell($effective_width, 12, $item['description'], 0, 'C'); $pdf->SetX($left + $width * $column); $pdf->SetFontSize($this->BIG_FONT); $pdf->Cell($effective_width, 25, $price, 0, 1, 'C'); $y_pos = $pdf->GetY(); if ($item['startDate'] != '' && $item['endDate'] != '') { // intl would be nice $datestr = $this->getDateString($item['startDate'], $item['endDate']); $pdf->SetXY($left + $width * $column, $top + ($height - 40)); $pdf->SetFontSize($this->SMALL_FONT); $pdf->Cell($effective_width, 20, $datestr, 0, 1, 'R'); } if ($item['originName'] != '') { $pdf->SetXY($left + $width * $column, $y_pos); $pdf->SetFontSize($this->SMALL_FONT); if (strlen($item['originName']) < 50) { $pdf->Cell($effective_width, 20, $item['originName'], 0, 1, 'L'); } else { $pdf->Cell($effective_width, 20, $item['originShortName'], 0, 1, 'L'); } } } $pdf->Output('WfcProdSingle.pdf', 'I'); }
function preprocess() { if (FormLib::get_form_value('start', False) !== False) { $pdf = new FPDF('P', 'in', 'Letter'); $pdf->SetMargins(0.5, 0.5, 0.5); $pdf->SetAutoPageBreak(False, 0.5); $pdf->AddPage(); $start = FormLib::get_form_value('start'); $x = 0.5; $y = 0.5; $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->SetFont('Gill', '', 16); for ($i = 0; $i < 40; $i++) { $current = $start + $i; $pdf->SetXY($x, $y); $pdf->Cell(1.75, 0.5, $current, 0, 0, 'C'); $pdf->Cell(1.75, 0.5, $current, 0, 0, 'C'); if ($i % 2 == 0) { $x += 1.75 * 2 + 0.5; } else { $x = 0.5; $y += 0.5; } } $pdf->Close(); $pdf->Output("mem stickers {$start}.pdf", "I"); return False; } return True; }
/** * Save PHPExcel to file * * @param string $pFileName * @throws Exception */ public function save($pFilename = null) { // Open file global $cnf; $pFilename= $cnf['path']['Temp'] . $pFilename; $fileHandle = fopen($pFilename, 'w'); if ($fileHandle === false) { throw new Exception("Could not open file $pFilename for writing."); } // Fetch sheets $sheets = array(); if (is_null($this->_sheetIndex)) { $sheets = $this->_phpExcel->getAllSheets(); } else { $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex); } // PDF paper size $paperSize = 'A4'; // Create PDF $pdf = new FPDF('P', 'pt', $paperSize); // Loop all sheets foreach ($sheets as $sheet) { // PDF orientation $orientation = 'P'; if ($sheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) { $orientation = 'L'; } // Start sheet $pdf->SetAutoPageBreak(true); $pdf->SetFont('Arial', '', 10); $pdf->AddPage($orientation); // Get worksheet dimension $dimension = explode(':', $sheet->calculateWorksheetDimension()); $dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]); $dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1; $dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]); $dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1; // Calculate column widths $sheet->calculateColumnWidths(); // Loop trough cells for ($row = $dimension[0][1]; $row <= $dimension[1][1]; $row++) { // Line height $lineHeight = 0; // Calulate line height for ($column = $dimension[0][0]; $column <= $dimension[1][0]; $column++) { $rowDimension = $sheet->getRowDimension($row); $cellHeight = PHPExcel_Shared_Drawing::pixelsToPoints( PHPExcel_Shared_Drawing::cellDimensionToPixels($rowDimension->getRowHeight()) ); if ($cellHeight <= 0) { $cellHeight = PHPExcel_Shared_Drawing::pixelsToPoints( PHPExcel_Shared_Drawing::cellDimensionToPixels($sheet->getDefaultRowDimension()->getRowHeight()) ); } if ($cellHeight <= 0) { $cellHeight = $sheet->getStyleByColumnAndRow($column, $row)->getFont()->getSize(); } if ($cellHeight > $lineHeight) { $lineHeight = $cellHeight; } } // Output values for ($column = $dimension[0][0]; $column <= $dimension[1][0]; $column++) { // Start with defaults... $pdf->SetFont('Arial', '', 10); $pdf->SetTextColor(0, 0, 0); $pdf->SetDrawColor(100, 100, 100); $pdf->SetFillColor(255, 255, 255); // Coordinates $startX = $pdf->GetX(); $startY = $pdf->GetY(); // Cell exists? $cellData = ''; if ($sheet->cellExistsByColumnAndRow($column, $row)) { if ($sheet->getCellByColumnAndRow($column, $row)->getValue() instanceof PHPExcel_RichText) { $cellData = $sheet->getCellByColumnAndRow($column, $row)->getValue()->getPlainText(); } else { if ($this->_preCalculateFormulas) { $cellData = PHPExcel_Style_NumberFormat::ToFormattedString( $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue(), $sheet->getstyle( $sheet->getCellByColumnAndRow($column, $row)->getCoordinate() )->getNumberFormat()->getFormatCode() ); } else { $cellData = PHPExcel_Style_NumberFormat::ToFormattedString( $sheet->getCellByColumnAndRow($column, $row)->getValue(), $sheet->getstyle( $sheet->getCellByColumnAndRow($column, $row)->getCoordinate() )->getNumberFormat()->getFormatCode() ); } } } // Style information $style = $sheet->getStyleByColumnAndRow($column, $row); // Cell width $columnDimension = $sheet->getColumnDimensionByColumn($column); if ($columnDimension->getWidth() == -1) { $columnDimension->setAutoSize(true); $sheet->calculateColumnWidths(false); } $cellWidth = PHPExcel_Shared_Drawing::pixelsToPoints( PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth()) ); // Cell height $rowDimension = $sheet->getRowDimension($row); $cellHeight = PHPExcel_Shared_Drawing::pixelsToPoints( PHPExcel_Shared_Drawing::cellDimensionToPixels($rowDimension->getRowHeight()) ); if ($cellHeight <= 0) { $cellHeight = $style->getFont()->getSize(); } // Column span? Rowspan? $singleCellWidth = $cellWidth; $singleCellHeight = $cellHeight; foreach ($sheet->getMergeCells() as $cells) { if ($sheet->getCellByColumnAndRow($column, $row)->isInRange($cells)) { list($first, ) = PHPExcel_Cell::splitRange($cells); if ($first == $sheet->getCellByColumnAndRow($column, $row)->getCoordinate()) { list($colSpan, $rowSpan) = PHPExcel_Cell::rangeDimension($cells); $cellWidth = $cellWidth * $colSpan; $cellHeight = $cellHeight * $rowSpan; } break; } } // Cell height OK? if ($cellHeight < $lineHeight) { $cellHeight = $lineHeight; $singleCellHeight = $cellHeight; } // Font formatting $fontStyle = ''; if ($style->getFont()->getBold()) { $fontStyle .= 'B'; } if ($style->getFont()->getItalic()) { $fontStyle .= 'I'; } if ($style->getFont()->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) { $fontStyle .= 'U'; } $pdf->SetFont('Arial', $fontStyle, $style->getFont()->getSize()); // Text alignment $alignment = 'L'; switch ($style->getAlignment()->getHorizontal()) { case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: $alignment = 'C'; break; case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: $alignment = 'R'; break; case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: $alignment = 'J'; break; case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: default: $alignment = 'L'; break; } // Text color $pdf->SetTextColor( hexdec(substr($style->getFont()->getColor()->getRGB(), 0, 2)), hexdec(substr($style->getFont()->getColor()->getRGB(), 2, 2)), hexdec(substr($style->getFont()->getColor()->getRGB(), 4, 2)) ); // Fill color if ($style->getFill()->getFillType() != PHPExcel_Style_Fill::FILL_NONE) { $pdf->SetFillColor( hexdec(substr($style->getFill()->getStartColor()->getRGB(), 0, 2)), hexdec(substr($style->getFill()->getStartColor()->getRGB(), 2, 2)), hexdec(substr($style->getFill()->getStartColor()->getRGB(), 4, 2)) ); } // Border color $borders = ''; if ($style->getBorders()->getLeft()->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { $borders .= 'L'; $pdf->SetDrawColor( hexdec(substr($style->getBorders()->getLeft()->getColor()->getRGB(), 0, 2)), hexdec(substr($style->getBorders()->getLeft()->getColor()->getRGB(), 2, 2)), hexdec(substr($style->getBorders()->getLeft()->getColor()->getRGB(), 4, 2)) ); } if ($style->getBorders()->getRight()->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { $borders .= 'R'; $pdf->SetDrawColor( hexdec(substr($style->getBorders()->getRight()->getColor()->getRGB(), 0, 2)), hexdec(substr($style->getBorders()->getRight()->getColor()->getRGB(), 2, 2)), hexdec(substr($style->getBorders()->getRight()->getColor()->getRGB(), 4, 2)) ); } if ($style->getBorders()->getTop()->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { $borders .= 'T'; $pdf->SetDrawColor( hexdec(substr($style->getBorders()->getTop()->getColor()->getRGB(), 0, 2)), hexdec(substr($style->getBorders()->getTop()->getColor()->getRGB(), 2, 2)), hexdec(substr($style->getBorders()->getTop()->getColor()->getRGB(), 4, 2)) ); } if ($style->getBorders()->getBottom()->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { $borders .= 'B'; $pdf->SetDrawColor( hexdec(substr($style->getBorders()->getBottom()->getColor()->getRGB(), 0, 2)), hexdec(substr($style->getBorders()->getBottom()->getColor()->getRGB(), 2, 2)), hexdec(substr($style->getBorders()->getBottom()->getColor()->getRGB(), 4, 2)) ); } if ($borders == '') { $borders = 0; } if ($sheet->getShowGridlines()) { $borders = 'LTRB'; } // Image? $iterator = $sheet->getDrawingCollection()->getIterator(); while ($iterator->valid()) { if ($iterator->current()->getCoordinates() == PHPExcel_Cell::stringFromColumnIndex($column) . ($row + 1)) { try { $pdf->Image( $iterator->current()->getPath(), $pdf->GetX(), $pdf->GetY(), $iterator->current()->getWidth(), $iterator->current()->getHeight(), '', $this->_tempDir ); } catch (Exception $ex) { } } $iterator->next(); } // Print cell $pdf->MultiCell( $cellWidth, $cellHeight, $cellData, $borders, $alignment, ($style->getFill()->getFillType() == PHPExcel_Style_Fill::FILL_NONE ? 0 : 1) ); // Coordinates $endX = $pdf->GetX(); $endY = $pdf->GetY(); // Revert to original Y location if ($endY > $startY) { $pdf->SetY($startY); if ($lineHeight < $lineHeight + ($endY - $startY)) { $lineHeight = $lineHeight + ($endY - $startY); } } $pdf->SetX($startX + $singleCellWidth); // Hyperlink? if ($sheet->getCellByColumnAndRow($column, $row)->hasHyperlink()) { if (!$sheet->getCellByColumnAndRow($column, $row)->getHyperlink()->isInternal()) { $pdf->Link( $startX, $startY, $endX - $startX, $endY - $startY, $sheet->getCellByColumnAndRow($column, $row)->getHyperlink()->getUrl() ); } } } // Garbage collect! $sheet->garbageCollect(); // Next line... $pdf->Ln($lineHeight); } } // Document info $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); // Write to file fwrite($fileHandle, $pdf->output($pFilename, 'S')); // Close file fclose($fileHandle); }
public function get_id_pdf_handler() { global $FANNIE_ROOT; if (!class_exists('FPDF')) { include $FANNIE_ROOT . 'src/fpdf/fpdf.php'; define('FPDF_FONTPATH', 'font/'); } $this->get_id_handler(); // load models $loan_info = GumLib::loanSchedule($this->loan); $pdf = new FPDF('P', 'mm', 'Letter'); $pdf->SetMargins(6.35, 6.35, 6.35); // quarter-inch margins $pdf->SetAutoPageBreak(false); $pdf->AddPage(); $pdf->SetXY(0, 0); $pdf->Image('img/letterhead.png', null, null, 203); // scale to 8" $pdf->SetFont('Arial', '', 8); $line_height = 3.5; $pdf->SetXY(6.35, 43); $text = 'Pursuant to the terms of your Promissory Note with WFC, below please find a check for the principal and, as applicable, compound interest due. A statement showing the terms of your loan and annual compounding of the interest thereon is provided. If your loan was for more than 0.00% interest, also below is an IRS form 1099-INT to be included with your ' . date('Y') . ' federal tax filing. If you have questions regarding this payment, please contact Financial Manager Dale Maiers (dmaiers@wholefoods.coop). Thank you very much for your support.'; $pdf->Write($line_height, $text); $col_width = 40.64; $col1 = 6.35 + $col_width; $col2 = $col1 + $col_width; $col3 = $col2 + $col_width; $col4 = $col3 + $col_width; $table_y = 60; $pdf->SetFont('Arial', 'BU', 8); $pdf->SetXY($col1, $table_y); $pdf->Cell($col_width, $line_height, 'Ending Period', 0, 0, 'C'); $pdf->SetXY($col2, $table_y); $pdf->Cell($col_width, $line_height, 'Days', 0, 0, 'C'); $pdf->SetXY($col3, $table_y); $pdf->Cell($col_width, $line_height, 'Interest', 0, 0, 'R'); $pdf->SetXY($col4, $table_y); $pdf->Cell($col_width, $line_height, 'Closing Balance', 0, 0, 'R'); $pdf->SetFont('Arial', '', 8); $i = 0; for ($i = 0; $i < count($loan_info['schedule']); $i++) { $line_y = $table_y + ($i + 1) * $line_height; $pdf->SetXY($col1, $line_y); $pdf->Cell($col_width, $line_height, $loan_info['schedule'][$i]['end_date'], 0, 0, 'C'); $pdf->SetXY($col2, $line_y); $pdf->Cell($col_width, $line_height, $loan_info['schedule'][$i]['days'], 0, 0, 'C'); $pdf->SetXY($col3, $line_y); $pdf->Cell($col_width, $line_height, number_format($loan_info['schedule'][$i]['interest'], 2), 0, 0, 'R'); $pdf->SetXY($col4, $line_y); $pdf->Cell($col_width, $line_height, number_format($loan_info['schedule'][$i]['balance'], 2), 0, 0, 'R'); } $last_y = $table_y + ($i + 1) * $line_height; $pdf->SetFont('Arial', 'B', 8); $pdf->SetXY($col1, $last_y); $pdf->Cell($col_width, $line_height, 'Total', 0, 0, 'C'); $pdf->SetXY($col2, $last_y); $pdf->Cell($col_width, $line_height, number_format($this->loan->principal(), 2), 0, 0, 'R'); $pdf->SetXY($col3, $last_y); $pdf->Cell($col_width, $line_height, number_format($loan_info['total_interest'], 2), 0, 0, 'R'); $pdf->SetXY($col4, $last_y); $pdf->Cell($col_width, $line_height, number_format($loan_info['balance'], 2), 0, 0, 'R'); $pdf->SetFont('Arial', '', 8); $pdf->SetXY(6.35, $table_y); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell($col_width, $line_height, 'Loan Amount', 0, 1, 'C'); $pdf->SetFont('Arial', '', 8); $pdf->Cell($col_width, $line_height, number_format($this->loan->principal(), 2), 0, 1, 'C'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell($col_width, $line_height, 'Term', 0, 1, 'C'); $pdf->SetFont('Arial', '', 8); $pdf->Cell($col_width, $line_height, $this->loan->termInMonths() / 12 . ' Years', 0, 1, 'C'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell($col_width, $line_height, 'Loan Date', 0, 1, 'C'); $pdf->SetFont('Arial', '', 8); $pdf->Cell($col_width, $line_height, date('m/d/Y', strtotime($this->loan->loanDate())), 0, 1, 'C'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell($col_width, $line_height, 'Interest Rate', 0, 1, 'C'); $pdf->SetFont('Arial', '', 8); $pdf->Cell($col_width, $line_height, 100 * $this->loan->interestRate() . '%', 0, 1, 'C'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell($col_width, $line_height, 'Maturity Date', 0, 1, 'C'); $pdf->SetFont('Arial', '', 8); $ld = strtotime($this->loan->loanDate()); $ed = mktime(0, 0, 0, date('n', $ld) + $this->loan->termInMonths(), date('j', $ld), date('Y', $ld)); $pdf->Cell($col_width, $line_height, date('m/d/Y', $ed), 0, 1, 'C'); $pdf->SetDrawColor(0, 0, 0); $pdf->Line(6.35, $table_y, 6.35 + $col_width, $table_y); $pdf->Line(6.35, $table_y, 6.35, $table_y + 10 * $line_height); $pdf->Line(6.35 + $col_width, $table_y, 6.35 + $col_width, $table_y + 10 * $line_height); $pdf->Line(6.35, $table_y + 10 * $line_height, 6.35 + $col_width, $table_y + 10 * $line_height); for ($i = 2; $i <= 8; $i += 2) { $pdf->Line(6.35, $table_y + $i * $line_height, 6.35 + $col_width, $table_y + $i * $line_height); } $fields = array(1 => $loan_info['total_interest']); $this->settings->key('storeStateID'); if ($this->settings->load()) { $fields[12] = $this->settings->value(); } $this->settings->key('storeState'); if ($this->settings->load()) { $fields[11] = $this->settings->value(); } $ssn = 'Unknown'; if ($this->taxid->load()) { $ssn = 'xxx-xx-' . $this->taxid->maskedTaxIdentifier(); } $form = new GumTaxFormTemplate($this->custdata, $this->meminfo, $ssn, date('Y'), $fields, $this->loan->accountNumber()); $ret .= $form->renderAsPDF($pdf, 105); $check = new GumCheckTemplate($this->custdata, $this->meminfo, $loan_info['balance'], 'Loan Repayment', $this->check_info->checkNumber()); $check->renderAsPDF($pdf); $pdf->Output('LoanPayoff.pdf', 'I'); if (FormLib::get('issued') == '1') { $this->check_info->checkIssued(1); $this->check_info->issueDate(date('Y-m-d H:i:s')); $this->check_info->save(); } return false; }
function generatePDF($print_id, $print_type = 1) { include "config.php"; require_once 'fpdf/fpdf.php'; $db = go\DB\DB::create($db_params, 'mysql'); $db->query('SET CHARACTER SET cp1251'); $get_print = $db->query('SELECT `finish_number`, `valve_type_id` FROM {numbers} WHERE `print_id`=?', array($_GET['print_id']))->assoc(); $get_print_info = $db->query('SELECT DISTINCT(`nm`.`order`) as `order`, `us`.`name` as `name`, `nm`.`print_id` as `print_id` FROM {numbers} `nm` LEFT JOIN {users} `us` ON (`nm`.`user_id` = `us`.`id`) WHERE `print_id`=?', array($_GET['print_id']))->row(); define('FPDF_FONTPATH', 'fpdf/fonts'); $pdf = new FPDF("L", "mm", array("88", "7")); $pdf->AddFont('Arial-BoldMT', 'B', 'arial_bold.php'); $pdf->SetFont('Arial-BoldMT', 'B', 11); $pdf->SetTextColor(0); //Add info for this order $pdf->AddPage('L'); $pdf->SetAutoPageBreak(false); $pdf->SetXY(0, 0); $pdf->Cell(43, 7, $get_print_info['name'], 0, 0, "C", 0); $pdf->Cell(4, 7, '', 0, 0, "C", 0); $pdf->Cell(43, 7, $get_print_info['order'], 0, 0, "C", 0); //End of add for ($i = 0; $i < count($get_print); $i++) { $pdf->AddPage('L'); $pdf->SetAutoPageBreak(false); $pdf->SetXY(0, 0); $pdf->Cell(43, 7, 'Ser.: ' . $get_print[$i]['finish_number'], 0, 0, "C", 0); $pdf->Cell(4, 7, '', 0, 0, "C", 0); if ($i + $print_type < count($get_print)) { $pdf->Cell(43, 7, 'Ser.: ' . $get_print[$i + $print_type]['finish_number'], 0, 0, "C", 0); } $pdf->SetAutoPageBreak(false); $i += $print_type; } return $pdf->Output($get_print_info['print_id'] . '.pdf', 'I'); }
function CetakLaporan($prevtahun, $tahun, $nexttahun, $urutan, $gel) { include_once "../fpdf.php"; require_once "../phplot.php"; $lbr = 190; $arrStatusAplikan = array(); $s = "select * from statusaplikan where KodeID='" . KodeID . "' order by Urutan ASC"; $r = _query($s); while ($w = _fetch_array($r)) { $arrStatusAplikan[] = $w['StatusAplikanID']; } $arrGelombang = array(); getArrayGelombang($arrGelombang, $tahun); // Buat Graph dan dimasukkan ke file dulu $piepath = '../tmp/data_fakta_pmb_pie_graph.png'; $barpath = '../tmp/data_fakta_pmb_bar_graph.png'; BuatPieGraph($piepath, $prevtahun, $tahun, $urutan, $gel); BuatBarGraph($barpath, $prevtahun, $tahun, $arrStatusAplikan, $urutan, $gel); // *** Cetak *** $pdf = new FPDF('L', 'mm', 'A4'); $pdf->SetAutoPageBreak(true, 5); $pdf->SetTitle("DATA & FAKTA PMB TAHUN AJARAN {$tahun}/{$nexttahun} GELOMBANG " . UbahKeRomawiLimit99($urutan)); $pdf->AddPage('L'); BuatHeaderLap($prevtahun, $tahun, $pdf); TampilkanIsinya($prevtahun, $tahun, $arrStatusAplikan, $arrGelombang, $pdf); TampilkanGraph($piepath, 30, 75, 96, 64, $pdf); TampilkanGraph($barpath, 185, 75, 96, 64, $pdf); TampilkanSumberInformasi(60, 145, $prevtahun, $tahun, $urutan, $gel, $pdf); TampilkanRatioPresenter(185, 145, $arrStatusAplikan, $tahun, $urutan, $gel, $pdf); $pdf->Output(); }
public function post_id_handler() { if (!is_array($this->id)) { $this->id = array($this->id); } $today = date("F j, Y"); $pdf = new FPDF('L', 'in', array(3.5, 5.0)); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $primary = ""; $pdf->SetAutoPageBreak(true, 0); $pdf->SetFont("Gill", "", 10); //Meat of the statement foreach ($this->id as $card_no) { $account = \COREPOS\Fannie\API\member\MemberREST::get($card_no); $pdf->AddPage(); $pdf->SetXY(3.0, 1.45); foreach ($account['customers'] as $c) { if ($c['accountHolder']) { $pdf->Cell(2, 0.25, $c['firstName'] . ' ' . $c['lastName'], "", 1, "L"); break; } } $pdf->SetX(3.0); $pdf->Cell(2, 0.25, $account['addressFirstLine'], "", 1, "L"); if ($account['addressSecondLine']) { $pdf->SetX(3.0); $pdf->Cell(2, 0.25, $account['addressSecondLine'], "", 1, "L"); } $pdf->SetX(3.0); $str = $account['city'] . ", " . $account['state'] . " " . $account['zip']; $pdf->Cell(2, 0.25, $str, "", 1, "L"); } $pdf->Output('member postcards.pdf', 'D'); return false; }
function class_pdf_maker($orientation = 'P', $unit = 'in', $format = 'letter') { parent::FPDF($orientation, $unit, $format); parent::SetMargins(0, 0); parent::Open(); parent::AddPage(); parent::SetAutoPageBreak(FALSE); }
public function drawPDF() { $pdf = new \FPDF('L', 'mm', 'Letter'); $pdf->SetMargins(3.175, 3.175, 3.175); $pdf->SetAutoPageBreak(false); $pdf = $this->loadPluginFonts($pdf); $pdf->SetFont($this->font, '', 16); $data = $this->loadItems(); $count = 0; $sign = 0; $width = 136.52; $height = 108; $top = 30; $left = 15; $effective_width = $width - 2 * $left; foreach ($data as $item) { if ($count % 4 == 0) { $pdf->AddPage(); $sign = 0; } $row = floor($sign / 2); $column = $sign % 2; $price = $this->printablePrice($item); $pdf->SetXY($left + $width * $column, $top + $row * $height); $pdf->SetFont($this->font, 'B', $this->SMALL_FONT); $pdf->Cell($effective_width, 10, $item['brand'], 0, 1, 'C'); $pdf->SetX($left + $width * $column); $pdf->SetFont($this->font, '', $this->MED_FONT); $item['description'] = str_replace("\r", '', $item['description']); $pdf->Cell($effective_width, 10, str_replace("\n", '', $item['description']), 0, 1, 'C'); $pdf->SetX($left + $width * $column); $pdf->SetFont($this->alt_font, '', $this->SMALLER_FONT); $item['size'] = $this->formatSize($item['size'], $item); $pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C'); $pdf->SetXY($left + $width * $column, $top + $row * $height + 35); $pdf->SetFont($this->font, '', $this->BIG_FONT); $pdf->Cell($effective_width, 20, $price, 0, 1, 'C'); if ($item['startDate'] != '' && $item['endDate'] != '') { // intl would be nice $datestr = $this->getDateString($item['startDate'], $item['endDate']); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 20)); $pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 20, $datestr, 0, 1, 'R'); } if ($item['originShortName'] != '' || isset($item['nonSalePrice'])) { $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 20)); $pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT); $text = $item['originShortName'] != '' ? $item['originShortName'] : sprintf('Regular Price: $%.2f', $item['nonSalePrice']); $pdf->Cell($effective_width, 20, $text, 0, 1, 'L'); } $count++; $sign++; } $pdf->Output('Signage4UpL.pdf', 'I'); }
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; }
/** * Constructor method * @param $orientation Page orientation * @param $format Page format * @author Pablo Dall'Oglio */ public function __construct($orientation = 'P', $format = 'a4') { parent::__construct($orientation, 'pt', $format); $this->setLocale(); parent::SetAutoPageBreak(true); parent::SetMargins(0, 0, 0); parent::SetCreator('Adianti Studio PDF Designer'); // parent::SetTitle('Letter'); // parent::SetKeywords('www.xyz.com.br'); parent::SetFillColor(255, 255, 255); parent::Open(); parent::AliasNbPages(); parent::SetX(20); $this->replaces = array(); $this->href = ''; $this->anchors = array(); $this->orientation = $orientation; $this->format = $format; parent::SetFont('Arial', '', 10 * 1.3); }
public function drawPDF() { $pdf = new \FPDF('L', 'mm', 'Letter'); $pdf->SetMargins(3.175, 3.175, 3.175); $pdf->SetAutoPageBreak(false); $pdf = $this->loadPluginFonts($pdf); $pdf->SetFont($this->font, '', 16); $data = $this->loadItems(); $count = 0; $sign = 0; $width = 50.8; $height = 63.5; $top = 32.23; $left = 12.7; $effective_width = $width - $left; foreach ($data as $item) { $item = $this->decodeItem($item); if ($count % 15 == 0) { $pdf->AddPage(); $sign = 0; } $row = floor($sign / 5); $column = $sign % 5; $price = $this->printablePrice($item); $pdf->SetXY($left + $width * $column, $top + $row * $height + 6); $pdf->SetFont($this->font, 'B', $this->SMALL_FONT); $font_shrink = 0; while (true) { $pdf->SetX($left + $width * $column); $y = $pdf->GetY(); $pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C'); if ($pdf->GetY() - $y > 6.005) { $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $font_shrink++; if ($font_shrink >= $this->SMALL_FONT) { break; } $pdf->SetFontSize($this->SMALL_FONT - $font_shrink); $pdf->SetXY($left + $width * $column, $y); } else { break; } } /** This block attempts to write the description then checks how many lines it took. If the description was longer than two lines, it whites the whole thing out, drops one font size, and tries again. Calculating effective text size with smart line breaks seems really tough. */ $pdf->SetFont($this->font, '', $this->MED_FONT); $font_shrink = 0; while (true) { $pdf->SetX($left + $width * $column); $y = $pdf->GetY(); $pdf->MultiCell($effective_width, 6, $item['description'], 0, 'C'); if ($pdf->GetY() - $y > 12) { $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $font_shrink++; if ($font_shrink >= $this->MED_FONT) { break; } $pdf->SetFontSize($this->MED_FONT - $font_shrink); $pdf->SetXY($left + $width * $column, $y); } else { if ($pdf->GetY() - $y < 12) { $words = explode(' ', $item['description']); $multi = ''; for ($i = 0; $i < floor(count($words) / 2); $i++) { $multi .= $words[$i] . ' '; } $multi = trim($multi) . "\n"; for ($i = floor(count($words) / 2); $i < count($words); $i++) { $multi .= $words[$i] . ' '; } $item['description'] = trim($multi); $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $pdf->SetXY($left + $width * $column, $y); $pdf->MultiCell($effective_width, 6, $item['description'], 0, 'C'); } break; } } $pdf->SetX($left + $width * $column); $pdf->SetFont($this->alt_font, '', $this->SMALLER_FONT); $item['size'] = $this->formatSize($item['size'], $item); $pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C'); if ($item['signMultiplier'] != -3) { $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 35)); $pdf->SetFont($this->font, '', $this->BIG_FONT); $pdf->Cell($effective_width, 12, $price, 0, 1, 'C'); } else { $pdf->SetXY(-5 + $left + $width * $column, $top + $height * $row + ($height - 35)); $pdf->SetFont($this->font, '', $this->MED_FONT); $pdf->MultiCell($effective_width / 2, 6, "BUY ONE\nGET ONE", 0, 'R'); $pdf->SetXY(-5 + $left + $width * $column + $effective_width / 2, $top + $height * $row + ($height - 35)); $pdf->SetFont($this->font, '', $this->BIG_FONT); $pdf->Cell($effective_width / 2, 12, 'FREE', 0, 1, 'L'); } if ($item['startDate'] != '' && $item['endDate'] != '') { // intl would be nice $datestr = $this->getDateString($item['startDate'], $item['endDate']); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 33)); $pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 20, strtoupper($datestr), 0, 1, 'R'); } if ($item['originShortName'] != '' || isset($item['nonSalePrice'])) { $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 33)); $pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT); $text = $item['originShortName'] != '' ? $item['originShortName'] : sprintf('Regular Price: $%.2f', $item['nonSalePrice']); $pdf->Cell($effective_width, 20, $text, 0, 1, 'L'); } $count++; $sign++; } $pdf->Output('Signage15UpL.pdf', 'I'); }
<?php require 'fpdf16/fpdf.php'; require 'connection.php'; validate_user(); $pdf = new FPDF(); $pdf->AliasNbPages(); $pdf->SetTopMargin(20); $pdf->SetLeftMargin(45); $pdf->SetAutoPageBreak(1, 0.5); $pdf->SetDisplayMode(100); $pdf->SetAutoPageBreak(true, 10); $pdf->AddPage(); //$pdf->AddPage('L'); $pdf->SetDisplayMode(110, "single"); $pdf->SetTitle("Netherhall House"); $border = 0; $pdf->SetFont('Arial', 'B', 10); $pdf->SetFillColor(255, 255, 255); $request = filter_input_array(INPUT_POST); if ($request[name] != "") { $r = mysql_query("SELECT * FROM residents LEFT JOIN countries on residents.country_id = countries.country_id WHERE name LIKE '%{$request[name]}%' OR surname LIKE '%{$request[name]}%'"); } else { $today = date("Y", time()) . "-" . date("m", time()) . "-" . date("d", time()); if (!isset($request[academic_year]) || $request[academic_year] == "current") { // >= 28 days = 4 weeks //$condition_search=" AND bookings.arrival <= '$today' AND bookings.departure >= '$today' AND DATEDIFF(bookings.departure,bookings.arrival) >= 28 "; // 06-Feb-2010 - They want to see all the residents in the current residents list. So I remove the condition about days. $condition_search = " AND bookings.arrival <= '{$today}' AND bookings.planned_departure >= '{$today}' "; } elseif ($request[academic_year] == "short") { // < 28 days = 4 weeks
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'); }
/** * Generate and save or stream a PDF file for this product voucher * * @since 1.0 * @param string $path optional absolute path to the voucher directory, if * not supplied the PDF will be streamed as a downloadable file (used * for admin previewing of the PDF) * * @return mixed nothing if a $path is supplied, otherwise a PDF download * @throws Exception if the voucher image is not available */ public function generate_pdf($path = '') { // include the pdf library define('FPDF_FONTPATH', wc_pdf_product_vouchers()->get_plugin_path() . '/lib/fpdf/font'); require_once wc_pdf_product_vouchers()->get_plugin_path() . '/lib/fpdf/fpdf.php'; $upload_dir = wp_upload_dir(); $image = wp_get_attachment_metadata($this->get_image_id()); // make sure the image hasn't been deleted through the media editor if (!$image) { throw new Exception(__("Voucher image not found", WC_PDF_Product_Vouchers::TEXT_DOMAIN)); } // make sure the file exists and is readable if (!is_readable($upload_dir['basedir'] . '/' . $image['file'])) { throw new Exception(sprintf(__("Voucher image file missing or not readable: %s", WC_PDF_Product_Vouchers::TEXT_DOMAIN), $upload_dir['basedir'] . '/' . $image['file'])); } // determine orientation: landscape or portrait if ($image['width'] > $image['height']) { $orientation = 'L'; } else { $orientation = "P"; } // get the width and height in points $width_pt = $this->convert_pixels_to_points($image['width']); $height_pt = $this->convert_pixels_to_points($image['height']); // Create the pdf // When writing text to a Cell, the text is vertically-aligned in the middle $fpdf = new FPDF($orientation, 'pt', array($width_pt, $height_pt)); $fpdf->AddPage(); $fpdf->SetAutoPageBreak(false); // set the voucher image $fpdf->Image($upload_dir['basedir'] . '/' . $image['file'], 0, 0, $width_pt, $height_pt); // this is useful for displaying the text cell borders when debugging the PDF layout, // though keep in mind that we translate the box position to align the text to bottom // edge of what the user selected, so if you want to see the originally selected box, // display that prior to the translation $show_border = 0; foreach ($this->voucher_fields as $field_name => $field) { switch ($field_name) { case 'message': // voucher message text, this is multi-line, so it's handled specially $this->textarea_field($fpdf, 'message', $this->get_message(), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); break; case 'product_name': // product name (allow optional wrapping) if (apply_filters('wc_pdf_product_vouchers_product_name_multi_line', false, $this)) { $this->textarea_field($fpdf, 'product_name', strtoupper($this->get_product_name()), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); } else { $this->text_field($fpdf, 'product_name', strtoupper($this->get_product_name()), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); } break; case 'product_sku': // product sku $this->text_field($fpdf, 'product_sku', $this->get_product_sku(), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); break; case 'recipient_name': // recepient name $this->text_field($fpdf, 'recipient_name', $this->get_recipient_name(), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); break; case 'recipient_email': // recepient email $this->text_field($fpdf, 'recipient_email', $this->get_recipient_email(), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); break; case 'expiration_date': // expiry date $this->text_field($fpdf, 'expiration_date', $this->get_formatted_expiration_date(), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); break; case 'voucher_number': // voucher number $this->text_field($fpdf, 'voucher_number', $this->get_voucher_number(), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); break; case 'voucher_product_price': // voucher number $this->text_field($fpdf, 'voucher_product_price', $this->wc_price($this->get_product_price()), $show_border, isset($field['text_align']) && $field['text_align'] ? $field['text_align'] : $this->voucher_text_align); break; case 'qr-code': case 'qrcode': case 'qr': // Voucher QR-code require_once wc_pdf_product_vouchers()->get_plugin_path() . '/lib/fpdf/qrcode/qrcode.class.php'; $qrcode = new QRcode(str_replace("{X}", $this->get_voucher_number(), $this->voucher_fields[strtolower($this->{$field_name})]["label"]), 'L'); // error level : L, M, Q, H $qrcode->disableBorder(); //header("Content-type: text/plain"); //print_r($this->voucher_fields[strtolower($this->$field_name)]["position"]["color"]); //exit(); //$qrcode->displayPNG(); //exit(); $qrcode->displayFPDF($fpdf, $this->voucher_fields[strtolower($this->{$field_name})]["position"]["x"], $this->voucher_fields[strtolower($this->{$field_name})]["position"]["y"], $this->voucher_fields[strtolower($this->{$field_name})]["position"]["width"], $this->voucher_fields[strtolower($this->{$field_name})]["position"]["background"], $this->voucher_fields[strtolower($this->{$field_name})]["position"]["color"]); break; default: //header("Content-type: text/plain"); //print $this->$field_name . ":\n"; //print_r($this->voucher_fields); //print "\n\n"; //exit(); // TODO: allowing custom fields in this manner could lead to name clashes if they use a reserved field name. have to deal with that later if (isset($field['multiline']) && $field['multiline']) { $this->textarea_field($fpdf, $field_name, apply_filters('wc_pdf_product_vouchers_voucher_field_value', $this->voucher_fields[strtolower($this->{$field_name})]["label"], $this, $field_name, $field), $show_border, isset($field['text_align']) ? $field['text_align'] : $this->voucher_text_align); } else { $this->text_field($fpdf, $field_name, apply_filters('wc_pdf_product_vouchers_voucher_field_value', $this->voucher_fields[strtolower($this->{$field_name})]["label"], $this, $field_name, $field), $show_border, isset($field['text_align']) ? $field['text_align'] : $this->voucher_text_align); } break; } } // has additional pages? foreach ($this->additional_image_ids as $additional_image_id) { $fpdf->AddPage(); $additional_image = wp_get_attachment_metadata($additional_image_id); $fpdf->Image($upload_dir['basedir'] . '/' . $additional_image['file'], 0, 0, $this->convert_pixels_to_points($additional_image['width'] < $image['width'] ? $additional_image['width'] : $image['width']), $this->convert_pixels_to_points($additional_image['height'] < $image['height'] ? $additional_image['height'] : $image['height'])); } if ($path) { // save the pdf as a file $fpdf->Output($this->get_voucher_full_filename($path), 'F'); } else { // download file $fpdf->Output('voucher-preview-' . $this->id . '.pdf', 'I'); } }
public function create5160MailingLabelFile($results, $name = "dummy_") { $name .= date("M_d_Y") . ".pdf"; $fpdf = new FPDF(); $fpdf->Open(); $fpdf->AddPage(); $fpdf->SetFont('Arial', 'B', 10); $fpdf->SetMargins(0, 0); $fpdf->SetAutoPageBreak(false); $x = 0; $y = 0; // create the array of the ids want to query the database for addresses foreach ($results as $student) { $st = new PSUPerson($student['spriden_id'], array('address')); $LabelText = sprintf("%s\n%s\n%s, %s, %s", $student['spriden_last_name'] . ", " . $student['spriden_first_name'] . " " . $student['spriden_mi'], $st->address['CA'][0]->street_line1, $st->address['CA'][0]->city, $st->address['CA'][0]->stat_code, $st->address['CA'][0]->zip); $this->Avery5160($x, $y, $fpdf, $LabelText); $y++; // next row if ($y == 10) { // end of page wrap to next column $x++; $y = 0; if ($x == 3) { // end of page $x = 0; $y = 0; $fpdf->AddPage(); } } $st->destroy(); } echo $fpdf->Output($name, $destination = 'd'); }
public function quotation() { // Vérification de la présence des bonnes données if (!isset($this->request->data['Project']['id']) || empty($this->request->data['Project']['id']) || !isset($this->request->data['Project']['dev_salary']) || empty($this->request->data['Project']['dev_salary']) || !isset($this->request->data['Project']['leaddev_salary']) || empty($this->request->data['Project']['leaddev_salary']) || !isset($this->request->data['Project']['tva']) || empty($this->request->data['Project']['tva'])) { die; } $id = base64_decode($this->request->data['Project']['id']); $this->loadModel('Macrotask'); $this->loadModel('Task'); $this->loadModel('User'); if (($project = $this->Project->findFirst(array('conditions' => array('Project.id' => $id)))) != null) { // On crée un nouveau document PDF $pdf = new FPDF(); $pdf->SetTitle("Devis - " . $project->name); $pdf->SetAuthor("E-Novative Keys"); $pdf->AddPage(); $pdf->SetAutoPageBreak(true); $pdf->SetFont('Helvetica', 'B', 12); $pdf->Image('http://enkwebservice.com/img/logo.png', 55, 6, 100); $pdf->Ln(30); $pdf->Cell(40, 20, "Devis Projet - " . iconv('UTF-8', 'windows-1252', $project->name)); $pdf->Ln(30); // On charge les macrotaches liées au projet $macrotasks = $this->Macrotask->find(array('conditions' => array('Macrotask.project_id' => $project->id))); $totalCost = 0; if ($macrotasks != null) { $pdf->Cell(40, 20, iconv('UTF-8', 'windows-1252', "Tâches effectuées sur ce projet :")); $pdf->Ln(15); $pdf->SetFont('Helvetica', '', 12); // Pour chaque macrotache... for ($i = 0; $i < count($macrotasks); $i++) { $task = $this->Task->find(array('conditions' => array("macrotask_id" => $macrotasks[$i]->id))); $hours = 0; // On charge les tâches et on additionne le temps de travail if ($task != null) { for ($j = 0; $j < count($task); $j++) { $hours += $task[$j]->hours; } } $users = $this->User->find(array('condition' => array('User.id IN' => '(SELECT user_id FROM macrotasks_users WHERE macrotask_id = ' . $macrotasks[$i]->id . ')'))); $roles = array('dev' => 0, 'leaddev' => 0); // On récupère le statut des utilisateurs ayant travaillé sur la macrotache if ($users != null) { for ($j = 0; $j < count($users); $j++) { if (in_array($users[$j]->role, array('trainee', 'employee', 'dev'))) { $roles['dev']++; } else { if (in_array($users[$j]->role, array('leaddev', 'admin'))) { $roles['leaddev']++; } } } } $cost = ($roles['dev'] * $this->request->data['Project']['dev_salary'] + $roles['leaddev'] * $this->request->data['Project']['leaddev_salary']) / ($roles['dev'] + $roles['leaddev']) * $hours; $totalCost += $cost; $pdf->Cell(10); $pdf->Cell(60, 20, iconv('UTF-8', 'windows-1252', $i + 1 . ". " . $macrotasks[$i]->name . " : ")); $pdf->Cell(40, 20, iconv('UTF-8', 'windows-1252', $cost . " € (HT)")); $pdf->Cell(40, 20, iconv('UTF-8', 'windows-1252', $cost + $cost * ($this->request->data['Project']['tva'] / 100) . " € (TTC)")); $pdf->Ln(10); } } $pdf->SetFont('Helvetica', 'B', 12); $pdf->Ln(20); $pdf->Cell(5); $pdf->Cell(65, 20, iconv('UTF-8', 'windows-1252', "Coût total HT : ")); $pdf->Cell(40, 20, iconv('UTF-8', 'windows-1252', $totalCost . " €")); $pdf->Ln(7); $pdf->Cell(5); $pdf->Cell(65, 20, iconv('UTF-8', 'windows-1252', "TVA appliquée : ")); $pdf->Cell(40, 20, iconv('UTF-8', 'windows-1252', $this->request->data['Project']['tva'] . " %")); $pdf->Ln(7); $pdf->Cell(5); $pdf->Cell(65, 20, iconv('UTF-8', 'windows-1252', "Remise appliquée : ")); $pdf->Cell(40, 20, iconv('UTF-8', 'windows-1252', $project->discount . " %")); $pdf->Ln(7); $pdf->Cell(5); $pdf->Cell(65, 20, iconv('UTF-8', 'windows-1252', "Coût total TTC : ")); $pdf->Cell(40, 20, iconv('UTF-8', 'windows-1252', $totalCost + $totalCost * ($this->request->data['Project']['tva'] / 100) - $totalCost * ($project->discount / 100) . " €")); $pdf->Output("Devis - " . $project->name . ".pdf ", 'I'); die; } }
public function drawPDF() { $pdf = new \FPDF('L', 'mm', 'Letter'); $pdf->SetMargins(3.175, 3.175, 3.175); $pdf->SetAutoPageBreak(false); define('FPDF_FONTPATH', dirname(__FILE__) . '/noauto/fonts/'); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php'); $pdf->AddFont('GillBook', '', 'GillSansMTPro-Book.php'); $pdf->SetFont('Gill', '', 16); $data = $this->loadItems(); $count = 0; $sign = 0; $width = 68.67; $height = 71; $top = 22; $left = 6.0; $effective_width = $width - $left; foreach ($data as $item) { if ($count % 12 == 0) { if ($count != 0) { // draw tick marks again // sometimes other content of the page // overwrites them $pdf->Line(2, $height + 0.0, 6, $height + 0.0); $pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0); $pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0); $pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0); $pdf->Line($width + 1.5, 2, $width + 1.5, 8); $pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8); $pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8); $pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height); $pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height); $pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height); } $pdf->AddPage(); // draw tick marks for cutting $pdf->Line(2, $height + 0.0, 6, $height + 0.0); $pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0); $pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0); $pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0); $pdf->Line($width + 1.5, 2, $width + 1.5, 8); $pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8); $pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8); $pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height); $pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height); $pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height); $sign = 0; } $row = floor($sign / 4); $column = $sign % 4; $price = $item['normal_price']; if ($item['scale']) { if (substr($price, 0, 1) != '$') { $price = sprintf('$%.2f', $price); } $price .= ' /lb.'; } elseif (isset($item['signMultiplier'])) { $price = $this->formatPrice($item['normal_price'], $item['signMultiplier']); } else { $price = $this->formatPrice($item['normal_price']); } $pdf->Image(dirname(__FILE__) . '/cd_head_16.png', $left - 1 + $width * $column, $top - 19 + $row * $height, $width - 6); $pdf->SetXY($left + $width * $column, $top + $row * $height + 1); $pdf->SetFont('Gill', 'B', $this->SMALL_FONT); $pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C'); /** This block attempts to write the description then checks how many lines it took. If the description was longer than two lines, it whites the whole thing out, drops one font size, and tries again. Calculating effective text size with smart line breaks seems really tough. */ $pdf->SetFont('Gill', '', $this->MED_FONT); $font_shrink = 0; while (true) { $pdf->SetX($left + $width * $column); $y = $pdf->GetY(); $pdf->MultiCell($effective_width, 7, $item['description'], 0, 'C'); if ($pdf->GetY() - $y > 14) { $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $font_shrink++; if ($font_shrink >= $this->MED_FONT) { break; } $pdf->SetFontSize($this->MED_FONT - $font_shrink); $pdf->SetXY($left + $width * $column, $y); } else { if ($pdf->GetY() - $y < 14) { $words = explode(' ', $item['description']); $multi = ''; for ($i = 0; $i < floor(count($words) / 2); $i++) { $multi .= $words[$i] . ' '; } $multi = trim($multi) . "\n"; for ($i = floor(count($words) / 2); $i < count($words); $i++) { $multi .= $words[$i] . ' '; } $item['description'] = trim($multi); $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $pdf->SetXY($left + $width * $column, $y); $pdf->MultiCell($effective_width, 7, $item['description'], 0, 'C'); } break; } } $pdf->SetX($left + $width * $column); $pdf->SetFont('GillBook', '', $this->SMALLER_FONT); $item['size'] = strtolower($item['size']); if (substr($item['size'], -1) != '.') { $item['size'] .= '.'; // end abbreviation w/ period $item['size'] = str_replace('fz.', 'fl oz.', $item['size']); } if (substr($item['size'], 0, 1) == '.') { $item['size'] = '0' . $item['size']; // add leading zero on decimal qty } if (strlen(ltrim($item['upc'], '0')) < 5 && $item['scale']) { $item['size'] = 'PLU# ' . ltrim($item['upc'], '0'); // show PLU #s on by-weight } $pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C'); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 42)); $pdf->SetFont('Gill', '', $this->BIG_FONT); $pdf->Cell($effective_width, 12, $price, 0, 1, 'C'); if ($item['startDate'] != '' && $item['endDate'] != '') { // intl would be nice $datestr = date('M d', strtotime($item['startDate'])) . chr(0x96) . date('M d', strtotime($item['endDate'])); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 37)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 20, strtoupper($datestr), 0, 1, 'R'); } if ($item['upc'] != '') { $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 37)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 20, $item['upc'], 0, 1, 'L'); } $pdf->Image(dirname(__FILE__) . '/' . $this->footer_image, $left - 1 + $width * $column, $top + $height * $row + ($height - $top - 4), $width - 6); $count++; $sign++; } $pdf->Output('Signage12UpL.pdf', 'I'); }
function _CetakLaporanPerbandinganIPS() { session_start(); include_once "../dwo.lib.php"; include_once "../db.mysql.php"; include_once "../connectdb.php"; include_once "../parameter.php"; include_once "../cekparam.php"; // *** Parameters *** include_once "../fpdf.php"; $pdf = new FPDF('L'); $pdf->SetTitle("Laporan Perbandingan IPS"); $pdf->SetAutoPageBreak(true, 5); $pdf->AddPage('L'); $pdf->SetFont('Helvetica', 'B', 9); // Tampilkan datanya HeaderLogo("LAPORAN PERBANDINGAN IPS", $pdf, 'L'); AmbilPerbandingan($_REQUEST['KelasID'], $_REQUEST['jmlsesi'] + 1, $pdf); $pdf->Output(); }
<?php require_once 'class.einzahlungsschein.php'; require_once 'fpdf/fpdf.php'; $amount = "150.20"; //Create a new pdf to create your invoice, already using FPDF //(if you don't understand this part you should have a look at the FPDF documentation) $pdf = new FPDF('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->SetAutoPageBreak(0, 0); $pdf->SetFont('Arial', '', 9); $pdf->Cell(50, 4, "Example red Einzahlungsschein (see bottom of this pdf)"); //now simply include your Einzahlungsschein, sending your pdf instance to the Einzahlungsschein class $ezs = new Einzahlungsschein(196, 0, $pdf); $ezs->setType('red'); $ezs->setPaymentReason('Invoice 34345'); $ezs->setBankData("Berner Kantonalbank AG", "3001 Bern", "01-200000-7"); $ezs->setRecipientData("My Company Ltd.", "Exampleway 61", "3001 Bern", "CH100023000A109822346"); $ezs->setPayerData("Heinz Müller", "Beispielweg 23", "3072 Musterlingen"); $ezs->setPaymentData($amount); $ezs->createEinzahlungsschein(false, true); $pdf->output();
<?php //session_start(); require '../impresion/fpdf2.php'; //require('../impresion/pdf_codabar.php'); require_once '../clases/cargocourier_data.php'; $cargo = new cargocourierdata(); $auxiliares = new auxiliaresdata(); //$pdf=new PDF_Codabar('P','cm','custom',609.449,935.5); $pdf = new FPDF('P', 'cm', 'custom', 609.449, 935.5); //ingreso medida puntos $pdf->SetTopMargin(1.3); $pdf->SetAutoPageBreak(1); $pdf->AddPage(); $pdf->SetFont('Arial', '', 8); $rs = $cargo->cargocourier_listar('', $_REQUEST['cargo_codigo'], '', '', '', '2', ''); $rs = mysql_query($rs, $cargo->con->cn); $campo = mysql_fetch_array($rs); $codigo = $campo['carcou_id']; $fecha = $cargo->util->obtienefecha($campo['carcou_fecha']); $origen = $auxiliares->devuelve_ciudad($campo['carcou_ciudadorigen']); $destino = $auxiliares->devuelve_ciudad($campo['ciu_id']); $centrocosto = $campo['carcou_centrocosto']; $area = $campo['empcou_razonsocial']; $remite = $campo['emprem_razonsocial']; $consignado = $campo['carcou_consignadoa']; $direccionconsignado = $campo['carcou_direccion']; $distritodestino = $campo['carcou_distrito']; $areacargo = $campo['area_descripcion']; $contacto = $campo['carcou_contacto']; $forma_pago = $campo['formpago_descripcion'];
if (mysqli_num_rows($rowsessionattente) == 0) { $attente = 0; } else { $nba = mysqli_num_rows($rowsessionattente); $attente = 1; } ///**********ECRITURE DU COURRIER /* initialisation/configuration de la classe*/ $courrier = new FPDF(); //font declaration des polices ! $courrier->AddFont('SourceSansPro-Regular', '', 'SourceSansPro-Regular.php'); $courrier->AddFont('SourceSansPro-Semibold', '', 'SourceSansPro-Semibold.php'); $courrier->AddFont('SourceSansPro-LightItalic', '', 'SourceSansPro-LightItalic.php'); $courrier->SetFont('SourceSansPro-Regular', '', 12); $courrier->open(); $courrier->SetAutoPageBreak(1, 15); $courrier->AddPage(); /* Création bloc emetteur */ $courrier->SetFont('SourceSansPro-Regular', '', 12); $courrier->Image($logo, 5, 10, 45, 27); $courrier->Ln(20); $courrier->SetXY(55, 15); $courrier->Cell(0, 5, $emetteur['nom'], 0, 2, 'L', false); //largeur,hauteur,,texte,bodure,suite,alignement,couleur de fond; $courrier->SetX(55); $courrier->MultiCell(0, 5, $emetteur['adr'], 0, 'L', false); //largeur,hauteur,,texte,bodure,suite,alignement,couleur de fond; $courrier->SetX(55); $courrier->MultiCell(0, 5, $emetteur['cp'] . " " . $ville, 0, 'L', false); //largeur,hauteur,,texte,bodure,suite,alignement,couleur de fond; $courrier->Ln(20);
$ref_pdf->Text(187, 284, sprintf('%d / {nb}', $ref_pdf->PageNo())); // Schriftfarbe setzen $ref_pdf->SetTextColor(0, 0, 0); } } // Laufzeit des Skriptes setzen set_time_limit(1000); // PDF-Bibliothek einbinden require_once './pdf/fpdf.php'; // alle Mitgliedernummern für die spätere Auslese ermitteln $mitgl_nr = getMitgliedsnummern(); $pdf_all = new FPDF('P', 'mm', 'A4'); // ... entspricht dem Aufruf von $pdf_all->AliasNbPages('{nb}'); // Automatischen Seitenumbruch deaktivieren $pdf_all->SetAutoPageBreak(false); // Seitenabstand definieren $pdf_all->SetMargins(25, 15, 15); foreach ($mitgl_nr as $mitglied) { // die Fluggeldkonto des Mitglieds ermitteln $data = getFluggeldkonto($mitglied['acb_nr'], $_POST['zeitraum_monat'], $_POST['zeitraum_jahr']); // es wird geprüft, ob überhaupt Daten zur Mitgliedsnummer // und dem aktuell ausgewählten Zeitraum vorliegen if (!empty($data)) { // neues PDF-Dokument erzeugen $pdf = new FPDF('P', 'mm', 'A4'); // ... entspricht dem Aufruf von $pdf->AliasNbPages('{nb}'); // Automatischen Seitenumbruch deaktivieren $pdf->SetAutoPageBreak(false); // Seitenabstand definieren
// Email : irvandygoutama@gmail.com // Start : 2 Juni 2009 session_start(); include_once "../dwo.lib.php"; include_once "../db.mysql.php"; include_once "../connectdb.php"; include_once "../parameter.php"; include_once "../cekparam.php"; include_once "../fpdf.php"; // *** Parameters *** $TahunID = GetSetVar('TahunID'); $ProdiID = GetSetVar('ProdiID'); // *** Init PDF $pdf = new FPDF(); $pdf->SetTitle("Daftar Mahasiswa Berdasarkan Angkatan"); $pdf->SetAutoPageBreak(true, 5); $lbr = 190; BuatIsinya($TahunID, $ProdiID, $pdf); $pdf->Output(); // *** FUnctions *** function BuatIsinya($TahunID, $ProdiID, $p) { $maxentryperpage = 45; $whr_prodi = empty($ProdiID) ? '' : "and h.ProdiID = '{$ProdiID}' "; $whr_tahun = empty($TahunID) ? '' : "and h.TahunID = '{$TahunID}' "; $s = "select h.*,\r\n m.Nama as NamaMhsw, m.TahunID as Angkatan, \r\n d.Nama as NamaPA, d.Gelar\r\n from khs h\r\n left outer join mhsw m on m.MhswID = h.MhswID and m.KodeID = '" . KodeID . "'\r\n left outer join dosen d on d.Login = m.PenasehatAkademik and d.KodeID = '" . KodeID . "'\r\n where h.KodeID = '" . KodeID . "'\r\n and h.TahunID = '{$TahunID}'\r\n and h.SKS > 0\r\n {$whr_prodi}\r\n\t {$whr_tahun}\r\n order by m.TahunID, h.MhswID"; $r = _query($s); $n = 0; $t = 5; $_thn = 'laksdjfalksdfh'; $ttl = 0;
<?php include_once '../simantz/class/fpdf/fpdf.php'; include_once "system.php"; //include_once "../system/class/Organization.php"; include_once "../simantz/class/Period.inc.php"; include_once "../bpartner/class/BPartner.php"; error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); $org = new Organization(); $bp = new BPartner(); $org->fetchOrganization($defaultorganization_id); $xmargin = 15; if ($_POST || $_GET) { $pdf = new FPDF('L', 'mm', "A5"); //0=A4,1=Letter $pdf->SetAutoPageBreak(true, 10); if (is_array($_POST['receipt_idarr'])) { $receipt_idarr = $_POST['receipt_idarr']; $isselect = $_POST['isselect']; } else { if (isset($_POST['receipt_id'])) { $receipt_id = $_POST['receipt_id']; } if (isset($_GET['receipt_id'])) { $receipt_id = $_GET['receipt_id']; } $receipt_idarr = array(1 => $receipt_id); $isselect = array(1 => "on"); } $i = 0; foreach ($receipt_idarr as $receipt_id) {
$this->SetY(-15); //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Número de página $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); } } //$pdf->FPDF('P','mm','A4'); $pdf = new FPDF('P', 'cm', 'custom', 300.28, 458.92); //ingreso medida puntos //$pdf->Open(); $pdf->AliasNbPages(); $pdf->SetLeftMargin(0.7); $pdf->PageNo(); $pdf->SetTopMargin(5); $pdf->SetAutoPageBreak(0.6); $pdf->AddPage(); $pdf->SetFont('Arial', '', 9); $venta->ventas_ver($_REQUEST['venta']); $nro_documento = $venta->ven_nrodoc; $cliente_nombre = $venta->cli_razonsocial; $cliente_direccion = $venta->cli_direccion; $cliente_ruc = $venta->cli_ruc; $e_fecha = $venta->_util->obtiene_fecha($venta->ven_fecha); $fecha = explode("/", $e_fecha); //si fecha esta en formato dia-mes-año $dia = $fecha[0]; $mes = $venta->_util->ver_nombre_mes($fecha[1]); $mes_numero = substr($fecha[3], 2); $anio = substr($fecha[2], 3); $pdf->Cell(1.2, 0.8, '', 0, 0, 'L');
$ref_pdf->Text(20, 284, utf8_decode('Druckdatum:')); $ref_pdf->Text(40, 284, date('d.m.Y H:i:s')); $ref_pdf->Text(75, 284, utf8_decode('Volksbank Butzbach - IBAN: DE29 5186 1403 0000 0370 52 - BIC: GENODE51BUT')); $ref_pdf->Text(187, 284, sprintf('%d / {nb}', $ref_pdf->PageNo())); // Schriftfarbe setzen $ref_pdf->SetTextColor(0, 0, 0); } } // PDF-Bibliothek einbinden require_once './pdf/fpdf.php'; // neues PDF-Dokument erzeugen $pdf = new FPDF('P', 'mm', 'A4'); // ... entspricht dem Aufruf von $pdf->AliasNbPages('{nb}'); // Automatischen Seitenumbruch deaktivieren $pdf->SetAutoPageBreak(false); // Seitenabstand definieren $pdf->SetMargins(25, 15, 15); // die Fluggeldkonten aller Mitglieder ermitteln $data = getTabelleFluggeldkonten(); // ******************************************************** SEITE ******************************************************** // // Seite hinzufügen $pdf->AddPage(); // Kopfzeile auf der aktuellen Seite hinzufügen pdf_header($pdf); $y = 35; foreach ($data as $saldo) { $pdf->SetXY(20, $y); // Schriftgrad einstellen $pdf->SetFont('Arial', '', 11); $pdf->Cell(20, 5.5, utf8_decode($saldo['acb_nr']), 0, 0, 'L');
// création du document $pdf->SetCreator($gepiSchoolName); // auteur du document $pdf->SetAuthor($gepiSchoolName); // mots clé $pdf->SetKeywords(''); // sujet du document $pdf->SetSubject('Bilan journalier des absences'); // titre du document $pdf->SetTitle('Bilan journalier des absences'); // méthode d'affichage du document à son ouverture $pdf->SetDisplayMode('fullwidth', 'single'); // compression du document $pdf->SetCompression(TRUE); // change automatiquement de page à 5mm du bas $pdf->SetAutoPageBreak(TRUE, 5); /* **************************** */ /* début de la boucle des pages */ // comptage du nombre de page traité $nb_page_traite = 0; // initialiser la variable compteur de ligne passé pour le tableau $nb_ligne_passe = 0; // initialiser un compteur temporaire autre que i // il serviras pour savoir à quelle endroit de la liste nous somme rendus $j = 0;
public function post_handler() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $fy = FormLib::get('fy'); $per_page = FormLib::get('per_page'); $custdata = new CustdataModel($dbc); $meminfo = new MeminfoModel($dbc); $query = $dbc->prepare(' SELECT p.cardno, p.cash_pat, m.zip, p.check_number FROM patronage AS p INNER JOIN meminfo AS m ON p.cardno=m.card_no INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1 WHERE p.FY=? ORDER BY m.zip, c.LastName, c.FirstName'); $result = $dbc->execute($query, array($fy)); $pdf = new FPDF('P', 'mm', 'Letter'); $pdf->SetMargins(6.35, 6.35, 6.35); // quarter-inch margins $pdf->SetAutoPageBreak(false); $filename = ''; $this->files = array(); $filenumber = 1; set_time_limit(0); while ($w = $dbc->fetch_row($result)) { if (empty($filename)) { $filename = $filenumber . '-' . substr($w['zip'], 0, 5); } $dbc = FannieDB::get($FANNIE_OP_DB); $custdata->CardNo($w['cardno']); $custdata->personNum(1); $custdata->load(); $meminfo->card_no($w['cardno']); $meminfo->load(); if ($w['check_number'] == '') { $patronage = new PatronageModel($dbc); $patronage->cardno($w['cardno']); $patronage->FY($fy); $number = GumLib::allocateCheck($patronage, false); $dbc = FannieDB::get($FANNIE_OP_DB); $patronage->check_number($number); $patronage->save(); $w['check_number'] = $number; } $pdf->AddPage(); $pdf->Image('rebate_body.png', 10, 0, 190); $check = new GumCheckTemplate($custdata, $meminfo, $w['cash_pat'], 'Rebate ' . $fy, $w['check_number']); $check->renderAsPDF($pdf); if ($pdf->PageNo() == $per_page) { $filename .= '-' . substr($w['zip'], 0, 5) . '.pdf'; $filenumber++; $pdf->Output('/tmp/' . $filename, 'F'); $this->files[] = $filename; $filename = ''; $pdf = new FPDF('P', 'mm', 'Letter'); $pdf->SetMargins(6.35, 6.35, 6.35); // quarter-inch margins $pdf->SetAutoPageBreak(false); } } $filename .= '-End.pdf'; $pdf->Output('/tmp/' . $filename, 'F'); $this->files[] = $filename; return true; }
public function post_id_upc_terms_handler() { $this->id = preg_split('/[^\\d]/', $this->id, 0, PREG_SPLIT_NO_EMPTY); $pdf = new FPDF('P', 'mm', 'Letter'); $pdf->SetMargins(6.35, 6.35, 6.35); // quarter-inch margins $pdf->SetAutoPageBreak(false); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php'); $margins = $pdf->GetMargins(); $margins['top'] = 0.0; $check_left_x = $margins['left'] > 3.175 ? $margins['right'] : 3.175 - $margins['left']; $real_check_top_y = 183.675 - $margins['top']; $check_right_x = 203.2 - $margins['left']; $real_check_bottom_y = 255.112 - $margins['top']; $line_height = 5; $envelope_window_tab = 15; $right_col1 = 130; $right_col2 = 170; $my_address = array('610 E 4th St', 'Duluth, MN 55805', 'Tel: 218.728.0884', 'www.wholefoods.coop'); $check_date = date('F j, Y'); $dbc = $this->connection; $dbc->setDefaultDB($this->config->get('OP_DB')); $signage = new COREPOS\Fannie\API\item\FannieSignage(array()); foreach ($this->id as $card_no) { $pdf->AddPage(); $account = \COREPOS\Fannie\API\member\MemberREST::get($card_no); $primary = array(); foreach ($account['customers'] as $c) { if ($c['accountHolder']) { $primary = $c; break; } } $check_number = rand(100000, 999995); for ($i = 0; $i < 3; $i++) { $pdf->SetFont('Gill', '', 10); $check_top_y = $real_check_top_y - $i * 90; $check_bottom_y = $real_check_bottom_y - $i * 90; $pdf->SetXY($check_left_x, $check_top_y); $pdf->Ln($line_height * 4.25); foreach ($my_address as $line) { $pdf->SetX($check_left_x + $envelope_window_tab + 20); if ($line == 'www.wholefoods.coop') { $pdf->SetFont('Gill', 'B', 9); } $pdf->Cell(0, $line_height, $line, 0, 1); } $pdf->SetFont('Gill', 'B', 10); $pdf->SetXY($check_left_x + $right_col1, $check_top_y); $pdf->Cell(30, $line_height, 'Check Number:', 0, 0, 'R'); $pdf->SetFont('Gill', '', 10); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->SetX($check_left_x + $right_col2); $pdf->Cell(30, $line_height, $check_number, 0, 0, 'R'); $pdf->SetFont('Gill', 'B', 10); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY($check_left_x + $right_col1, $check_top_y + 1.5 * $line_height); $pdf->Cell(30, $line_height, 'Date:', 0, 0, 'R'); $pdf->SetFont('Gill', '', 10); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->SetX($check_left_x + $right_col2); $pdf->Cell(30, $line_height, $check_date, 0, 0, 'R'); $pdf->SetXY($check_left_x + $right_col1, $check_top_y + 3 * $line_height); $pdf->SetFont('Gill', 'B', 10); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(30, $line_height, 'Amount:', 0, 0, 'R'); $pdf->SetXY($check_left_x + $right_col1 + 30, $check_top_y + 3 * $line_height); $pdf->SetFont('Gill', '', 10); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->MultiCell(40, $line_height, str_repeat(' ', 2) . $this->terms, 0, 'R'); $pdf->SetTextColor(0, 0, 0); $their_address = array($primary['firstName'] . ' ' . $primary['lastName']); $their_address[] = $account['addressFirstLine']; if ($account['addressSecondLine']) { $their_address[] = $account['addressSecondLine']; } $their_address[] = $account['city'] . ', ' . $account['state'] . ' ' . $account['zip']; $pdf->SetXY($check_left_x + $envelope_window_tab, $check_top_y + 11 * $line_height); $pdf->SetFont('Gill', 'B', 10); foreach ($their_address as $line) { $pdf->SetX($check_left_x + $envelope_window_tab); $pdf->Cell(0, $line_height, $line, 0, 1); } $pdf->SetFont('Gill', '', 10); $pdf->SetXY($check_left_x, $check_bottom_y + $line_height - 1); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('Gill', 'B', 10); $pdf->Cell(0, $line_height, 'Redeemable only at Whole Foods Co-op', 0, 0, 'C'); $pdf->SetFont('Gill', '', 10); $pdf->SetXY($check_left_x + 145, $check_top_y + 6 * $line_height + 1); $pdf->SetFont('Gill', '', 8); $pdf->MultiCell(50, $line_height - 2, 'Limit one per day. Cannot be applied to previous purchases. No cash value.'); $pdf->SetFont('Gill', '', 10); $pdf->SetFillColor(0xcc, 0xcc, 0xcc); $pdf->Rect($check_left_x + 84, $check_top_y + 28, 39, 15, 'F'); $pdf->SetFillColor(0, 0, 0); $signage->drawBarcode(ltrim($this->upc, '0'), $pdf, $check_left_x + 87, $check_top_y + 30, array('height' => 11, 'fontsize' => 0)); $pdf->Image('logo.rgb.noalpha.png', $check_left_x + $envelope_window_tab, $check_top_y + 20, 20); $pdf->SetFont('Gill', 'B', '31'); $pdf->SetXY($check_left_x + $envelope_window_tab, $check_top_y + 0.5 * $line_height); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->Cell(0, 3 * $line_height, 'We Appreciate You!'); $pdf->SetFont('Gill', '', '10'); $pdf->SetTextColor(0, 0, 0); $pdf->Image(dirname(__FILE__) . '/../GiveUsMoneyPlugin/img/sig.png', $check_right_x - 63.5, $check_top_y + 9 * $line_height, 63.5); $pdf->SetXY($check_right_x - 63.5, $check_top_y + 12 * $line_height); $pdf->Cell(63.5, $line_height, 'Authorized By Signature', 'T'); $check_number++; } } $pdf->Output(); }