public final function generate_attendees_PDF($tickets_list) { $this->load_pdf_libraries(); $pdf = new FPDF(); $ecp = TribeEvents::instance(); $pdf->AddFont('OpenSans', '', 'opensans.php'); $pdf->AddFont('SteelFish', '', 'steelfish.php'); $pdf->SetTitle('EventTicket'); $pdf->SetAuthor('The Events Calendar'); $pdf->SetCreator('The Events Calendar'); $defaults = array('event_id' => 0, 'ticket_name' => '', 'holder_name' => '', 'order_id' => '', 'ticket_id' => '', 'security_code' => ''); foreach ($tickets_list as $ticket) { $ticket = wp_parse_args($ticket, $defaults); $event = get_post($ticket['event_id']); $venue_id = tribe_get_venue_id($event->ID); $venue = !empty($venue_id) ? get_post($venue_id)->post_title : ''; $address = tribe_get_address($event->ID); $zip = tribe_get_zip($event->ID); $state = tribe_get_stateprovince($event->ID); $city = tribe_get_city($event->ID); $pdf->AddPage(); $pdf->SetDrawColor(28, 166, 205); $pdf->SetFillColor(28, 166, 205); $pdf->Rect(15, 10, 180, 34, 'F'); $pdf->SetTextColor(255); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 15); $pdf->Write(5, __('EVENT NAME:', 'tribe-events-calendar')); $pdf->SetXY(30, 28); $pdf->SetFont('SteelFish', '', 53); $title = strtoupper(utf8_decode($event->post_title)); $size = 53; while ($pdf->GetStringWidth($title) > 151) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $title); $pdf->SetTextColor(41); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 50); $pdf->Write(5, __('TICKET HOLDER:', 'tribe-events-calendar')); $pdf->SetXY(104, 50); $pdf->Write(5, __('LOCATION:', 'tribe-events-calendar')); $pdf->SetFont('SteelFish', '', 30); $pdf->SetXY(30, 59); $holder = strtoupper(utf8_decode($ticket['holder_name'])); $size = 30; while ($pdf->GetStringWidth($holder) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $holder); $pdf->SetXY(104, 59); $venue = strtoupper(utf8_decode($venue)); $size = 30; while ($pdf->GetStringWidth($venue) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $venue); $pdf->SetXY(104, 71); $address = strtoupper(utf8_decode($address)); $size = 30; while ($pdf->GetStringWidth($address) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $address); $pdf->SetXY(104, 83); $address2 = array($city, $state, $zip); $address2 = array_filter($address2); $address2 = join(', ', $address2); $address2 = strtoupper(utf8_decode($address2)); $size = 30; while ($pdf->GetStringWidth($address2) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $address2); $pdf->Line(15, 97, 195, 97); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 105); $pdf->Write(5, __('ORDER:', 'tribe-events-calendar')); $pdf->SetXY(80, 105); $pdf->Write(5, __('TICKET:', 'tribe-events-calendar')); $pdf->SetXY(120, 105); $pdf->Write(5, __('VERIFICATION:', 'tribe-events-calendar')); $pdf->SetFont('SteelFish', '', 53); $pdf->SetXY(30, 118); $pdf->Write(5, $ticket['order_id']); $pdf->SetXY(80, 118); $pdf->Write(5, $ticket['ticket_id']); $pdf->SetXY(120, 118); $pdf->Write(5, $ticket['security_code']); $pdf->Rect(15, 135, 180, 15, 'F'); $pdf->SetTextColor(255); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 140); $pdf->Write(5, get_bloginfo('name')); $pdf->SetXY(104, 140); $pdf->Write(5, get_home_url()); } $upload_path = wp_upload_dir(); $upload_url = $upload_path['url']; $upload_path = $upload_path['path']; $filename = wp_unique_filename($upload_path, sanitize_file_name(md5(time())) . '.pdf'); $upload_path = trailingslashit($upload_path) . $filename; $upload_url = trailingslashit($upload_url) . $filename; $pdf->Output($upload_path, 'F'); return array($upload_path, $upload_url); }
$name = $_POST['name']; $characteristics = $_POST['characteristics']; $image = $_POST['image']; require 'fpdf17/fpdf.php'; //create a FPDF object $pdf = new FPDF(); //set document properties $pdf->SetAuthor('Anon'); $pdf->SetTitle($name); //set font for the entire document $pdf->SetFont('Helvetica', 'B', 20); $pdf->SetTextColor(50, 60, 100); //set up a page $pdf->AddPage('P'); //$pdf->SetDisplayMode(real,'default'); //insert an image and make it a link $pdf->Image('logo.png', 10, 20, 33, 0); //display the title without a border around it $pdf->SetXY(50, 20); $pdf->SetDrawColor(50, 60, 100); $pdf->Cell(100, 10, $name, 0, 0, 'C', 0); // Insert a dynamic image from a URL $pdf->Image($image, 75, 30, 0, 50); //Set x and y position for the main text, reduce font size and write content $pdf->SetXY(10, 90); $pdf->SetFontSize(10); $pdf->Write(5, $characteristics); //Output the document $pdf->Output(); ?>
public function drawPDF() { $pdf = new \FPDF('P', 'mm', 'Letter'); $pdf->SetMargins(0, 3.175, 0); $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 = 53.975; $height = 68.95999999999999; $top = 20; $left = 5.175; $effective_width = $width - 2 * $left; $pdf->SetDrawColor(0, 0, 0); $pdf->SetLineWidth(0.2); foreach ($data as $item) { if ($count % 16 == 0) { $pdf->AddPage(); // draw tick marks for cutting $pdf->Line(2, $height + 1.5, 6, $height + 1.5); $pdf->Line(2, 2 * $height + 1.5, 6, 2 * $height + 1.5); $pdf->Line(2, 3 * $height + 1.5, 6, 3 * $height + 1.5); $pdf->Line($width, 2, $width, 6); $pdf->Line(2 * $width, 2, 2 * $width, 6); $pdf->Line(3 * $width, 2, 3 * $width, 6); $pdf->Line($width, 4 * $height - 4, $width, 4 * $height); $pdf->Line(2 * $width, 4 * $height - 4, 2 * $width, 4 * $height); $pdf->Line(3 * $width, 4 * $height - 4, 3 * $width, 4 * $height); $pdf->Line(4 * $width - 6, $height + 1.5, 4 * $width - 2, $height + 1.5); $pdf->Line(4 * $width - 6, 2 * $height + 1.5, 4 * $width - 2, 2 * $height + 1.5); $pdf->Line(4 * $width - 6, 3 * $height + 1.5, 4 * $width - 2, 3 * $height + 1.5); $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 - 2 + $width * $column, $top - 17 + $row * $height, $width - 6); $pdf->SetXY($left + $width * $column, $top + $row * $height - 2); $pdf->SetFont('Gill', '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) { $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->MED_FONT - $font_shrink); $pdf->SetXY($left + $width * $column, $y); } else { break; } } $pdf->SetX($left + $width * $column); $pdf->SetFont('Gill', '', $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('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 - $top - 18)); $pdf->SetFont('Gill', '', $this->BIG_FONT); $pdf->MultiCell($effective_width, 10, $price, 0, '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 - $top - 7)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width + 4, 6, strtoupper($datestr), 0, 1, 'R'); } if ($item['upc'] != '') { $pdf->SetXY($left - 2 + $width * $column, $top + $height * $row + ($height - $top - 7)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 6, $item['upc'], 0, 1, 'L'); } $pdf->Image(dirname(__FILE__) . '/' . $this->footer_image, $left - 2 + $width * $column, $top + $height * $row + ($height - $top - 2), $width - 6); $count++; $sign++; } $pdf->Output('Signage16UpP.pdf', 'I'); }
/** * 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 SetDrawColor($r, $g = -1, $b = -1) { if (is_string($r)) { $this->HTML2RGB($r, $r, $g, $b); } parent::SetDrawColor($r, $g, $b); }
function SetDrawColor($a, $b = null, $c = null) { if (is_array($a)) { $b = $a[1]; $c = $a[2]; $a = $a[0]; } if ($b == null) { $b = $c = $a; } return parent::SetDrawColor($a, $b, $c); }
public function SetDrawColor($r, $g = null, $b = null) { $c = $this->parseColours($r, $g, $b); return parent::SetDrawColor($c["red"], $c["green"], $c["blue"]); }
// Infos de la commande calées à gauche $pdf->Text(20, 80, 'N° de facture : '.$tCommande[0]['id']); $pdf->Text(20, 85, 'N° de client : '.$tCommande[0]['idClient']); // Infos du client calées à droite $pdf->Text(120, 50, $tClient['nomClient'].' '.$tClient['prenomClient']); $pdf->Text(120, 55, $tClient['adresseClient']); $pdf->Text(120, 60, $tClient['cpClient'].' '.$tClient['villeClient']); // Infos date $pdf->Text(120, 80, 'Buire, le '.date("d-m-Y", strtotime($tCommande[0]['dateFacture']))); /* --- Tableau détail commande --- */ // en-tête $pdf->SetDrawColor(183); // couleur du fond $pdf->SetFillColor(221); // couleur des filets $pdf->SetTextColor(0); // couleur du texte $pdf->SetY(100); $pdf->SetX(20); $pdf->Cell(80, 10, 'Description du produit', 1, 0, 'L', 1); $pdf->SetX(100); $pdf->Cell(20, 10, 'Quantité', 1, 0, 'C', 1); $pdf->SetX(120); $pdf->Cell(35, 10, 'Prix unitaire HT', 1, 0, 'C', 1); $pdf->SetX(155); $pdf->Cell(30, 10, 'Montant HT', 1, 0, 'C', 1); $pdf->Ln(); // retour à la ligne // détail commande $positionLigne = 110;
//------------------------ Agregar el imss de forma automatica -------------------- /* $conexion_extra= mysqli_connect("localhost", "adminnomina", "GNgOLWSQR780", "nominacetic", "3606"); $PA=mysqli_query($conexion_extra,"CALL calcula_imss('$ren[id]','$quincena',@sec)"); $row=mysqli_fetch_array($PA); $importe_imss=$row['total']; mysqli_close($conexion_extra); $insert="INSERT INTO nominapago(idnominaemp,cve_concepto,importe,tipo,quincena,anio,fechaemision,usuario,cve_sat,idarea) VALUES('$ren[id]','274','$importe_imss','D','$quincena',YEAR(NOW()),CURDATE(),'2','021','$ren[ur]')"; mysql_query($insert,$conexion);*/ //------------------------------------------------------------------------------------- if($otraur != $ren["ur"]) { $pdf->SetTextColor(0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(.2); $pdf->cell(57,7,"SUBTOTAL ($emp)", 1, 0, 'C'); $pdf->cell(22,7,number_format($Ssueldobase, 2, ".", ","), 1, 0, 'R'); $pdf->cell(22,7,number_format($Scompensacion, 2, ".", ","), 1, 0, 'R'); $pdf->cell(22,7,number_format($Sprima, 2, ".", ","), 1, 0, 'R'); $pdf->cell(20,7,number_format($Saguinaldo, 2, ".", ","), 1, 0, 'R'); $pdf->cell(22,7,number_format($Sotrasper, 2, ".", ","), 1, 0, 'R'); $pdf->cell(17,7,number_format($Sisr, 2, ".", ","), 1, 0, 'R'); $pdf->cell(17,7,number_format($Simss, 2, ".", ","), 1, 0, 'R'); $pdf->cell(22,7,number_format($Sotrasded, 2, ".", ","), 1, 0, 'R'); $pdf->cell(22,7,number_format($Sneto, 2, ".", ","), 1, 0, 'R'); $Ssueldobase = 0; $Scompensacion = 0;
$wprintable_BAD_REPLACE = $xMarginRight - $wBorderPicture - $xLeftTextMargin; $hUnderlineOffset = 7.15; $wSpace = 5; $hTwoLinesOffset = 5.5; //*************** //** PDF Build ** //*************** require_once "resources/includePath.inc"; require 'fpdf17/fpdf.php'; $pdf = new FPDF(); //default to mm units $pdf->AddFont('Porcelain', '', 'Porcelain.php'); $pdf->AddFont('DemiTasse', '', 'DemiTasse.php'); $pdf->AddPage('P', 'Letter'); //** Draw Page Outline Box ** $pdf->SetDrawColor(230, 230, 230); $pdf->Rect($xMarginLeft, $yMarginTop, $xMarginRight - $xMarginLeft, $yMarginBottom - $yMarginTop); //************************* //** Write Page Elements ** //************************* //** Images ** $imgScaleBorder = 97; $imgScaleWatermark = 75; $imgSpacingBorder = 1.5; $pdf->Image('resources/certificates/border_L.png', $xMarginLeft + $imgSpacingBorder, $yMarginTop + $imgSpacingBorder, $imgScaleBorder); $pdf->Image('resources/certificates/watermark_light.png', ($wTextArea - $imgScaleWatermark) / 2 + $xLeftTextMargin, $yMarginTop + 7, $imgScaleWatermark); $pdf->Image('resources/certificates/border_R.png', $xMarginRight - $imgSpacingBorder - $imgScaleBorder, $yMarginBottom - $imgSpacingBorder - $imgScaleBorder, $imgScaleBorder); //** Title ** $yLine = $yMarginTop + 16; $pdf->SetFont('Porcelain', '', 42); $pdf->SetY($yLine);
# $pdf->SetFont('Arial','B','16'); # $pdf->Cell(0,20, $judul, '0', 1, 'C'); # # #buat header tabel # $pdf->SetFont('Arial','','10'); # $pdf->SetFillColor(65,65,65); # $pdf->SetTextColor(255); # $pdf->SetDrawColor(128,0,0); # $pdf->Cell(10, 5, 'NO', 1, '0', 'C', true); # foreach ($header as $kolom) { # $pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0', $kolom['align'], true); # } # $pdf->Ln(); # $no2=1; # #tampilkan data tabelnya #
$pdf->SetAutoPageBreak(auto, 3); //$pdf->Ln(10); //include ("../conectar.php"); $codfactura = $_GET["codfactura"]; $consulta = "Select * from facturas,clientes where facturas.codfactura='{$codfactura}' and facturas.codcliente=clientes.codcliente"; $resultado = mysql_query($consulta, $conexion); $lafila = mysql_fetch_array($resultado); /*Fijo la línea de comienzo*/ if ($lafila["moneda"] == 2) { $moneda = "dolar.png"; } else { $moneda = "pesos.png"; } $pdf->SetFillColor(255, 255, 255); $pdf->SetTextColor(0); $pdf->SetDrawColor(0, 0, 0); $pdf->SetLineWidth(0.2); $pdf->SetFont('Arial', 'I', 9); $pdf->Cell(5); /* ubicación inicial de la celdas */ $pdf->Cell(50, 4, 'FERNANDO GÁMBARO ÁLVAREZ', 0, 0, 'C', 1); $pdf->Image('logo/logo_simple.jpg', 12, 10, -140); $pdf->Cell(100); /* ubicación inicial de la celdas */ $pdf->SetFont('Arial', '', 8); $pdf->Cell(50, 4, 'RUT 214355250015', 0, 0, 'C', 1); $pdf->Ln(10); /* Establezco el color de las celdas y tipo de letra */ $pdf->SetFillColor(134, 16, 16); $pdf->SetTextColor(255); $pdf->SetDrawColor(0, 0, 0);
$sql = mysql_query("SELECT @row_num := @row_num + 1 as id ,kehadiran.nak,nama,nik,status,no_kupon,id_kuasa,user,waktu from kehadiran join anggota using (nak) order by id"); $data = array(); while ($row = mysql_fetch_assoc($sql)) { array_push($data, $row); } $judul = "LAPORAN KEHADIRAN"; $header = array(array("label" => "No", "length" => 10, "align" => "L"), array("label" => "NAK", "length" => 10, "align" => "L"), array("label" => "Nama", "length" => 44, "align" => "L"), array("label" => "NIK", "length" => 15, "align" => "L"), array("label" => "Status", "length" => 15, "align" => "L"), array("label" => "No Kupon", "length" => 17, "align" => "L"), array("label" => "Id Kuasa", "length" => 15, "align" => "L"), array("label" => "User", "length" => 38, "align" => "L"), array("label" => "Waktu", "length" => 31, "align" => "L")); require_once "fpdf/fpdf.php"; $pdf = new FPDF('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', '16'); $pdf->Cell(0, 20, $judul, '0', 1, 'C'); $pdf->SetFont('Arial', '', '9'); $pdf->SetFillColor(0, 0, 0); $pdf->SetTextColor(255); $pdf->SetDrawColor(0, 0, 0); foreach ($header as $kolom) { $pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0', $kolom['align'], true); } $pdf->Ln(); $pdf->SetFillColor(255, 255, 255); $pdf->SetTextColor(0); $pdf->SetFont(''); $fill = false; foreach ($data as $baris) { $i = 0; foreach ($baris as $cell) { $pdf->Cell($header[$i]['length'], 5, $cell, 1, '0', $kolom['align'], $fill); $i++; } $fill = !$fill;
$pdf->Cell(0, 0, $row["MASA_DECLARADO"], 0, 0, "R"); $pdf->Ln(4); $pdf->SetFont("Arial", "B", 8); $pdf->Cell(48, 0, "Alícuota fija declarada por trabajador"); $pdf->SetFont("Arial", "", 8); $pdf->Cell(48, 0, $row["ALICUOTA_FIJA_T"]); $pdf->SetFont("Arial", "B", 8); $pdf->Cell(68, 0, "Alícuota variable declarada sobre la masa salarial"); $pdf->SetFont("Arial", "", 8); $pdf->Cell(26, 0, "% ".$row["ALICUOTA_VAR_T"], 0, 0, "R"); $pdf->SetDrawColor(0, 0, 0); $pdf->Rect(10, 34, 190, 4); $pdf->Rect(10, 38, 190, 16); $pdf->Rect(10, 54, 190, 4); $pdf->Rect(10, 62, 190, 4); $pdf->Rect(10, 66, 190, 12); $pdf->Rect(10, 82, 190, 4); $pdf->Rect(10, 86, 190, 12); $pdf->Ln(6); $pdf->Cell(-1); $pdf->SetFont("Arial", "B", 8); $pdf->Cell(80, 0, "Concepto"); $pdf->Cell(40, 0, "Débito"); $pdf->Cell(40, 0, "Crédito");
public function get_toIDs_handler() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $TRANS = $this->config->get('TRANS_DB') . $dbc->sep(); define('FPDF_FONTPATH', 'font/'); include dirname(__FILE__) . '/../src/fpdf/fpdf.php'; $pdf = new FPDF('P', 'mm', 'Letter'); //start new instance of PDF $pdf->Open(); //open new PDF Document $count = 0; $x = 0; $y = 0; $date = date("m/d/Y"); $infoP = $dbc->prepare_statement("SELECT ItemQtty,total,regPrice,p.card_no,description,department,\n CASE WHEN p.card_no=0 THEN o.lastName ELSE c.LastName END as name,\n CASE WHEN p.card_no=0 THEN o.firstName ELSE c.FirstName END as fname,\n CASE WHEN o.phone is NULL THEN m.phone ELSE o.phone END as phone,\n discounttype,quantity,\n p.mixMatch AS vendorName\n FROM {$TRANS}PendingSpecialOrder AS p\n LEFT JOIN custdata AS c ON p.card_no=c.CardNo AND personNum=p.voided\n LEFT JOIN meminfo AS m ON c.CardNo=m.card_no\n LEFT JOIN {$TRANS}SpecialOrders AS o ON o.specialOrderID=p.order_id\n WHERE trans_id=? AND p.order_id=?"); $flagP = $dbc->prepare_statement("UPDATE {$TRANS}PendingSpecialOrder SET charflag='P'\n WHERE trans_id=? AND order_id=?"); $idP = $dbc->prepare_statement("SELECT trans_id FROM {$TRANS}PendingSpecialOrder WHERE\n trans_id > 0 AND order_id=? ORDER BY trans_id"); $signage = new \COREPOS\Fannie\API\item\FannieSignage(array()); foreach ($this->toIDs as $toid) { if ($count % 4 == 0) { $pdf->AddPage(); $pdf->SetDrawColor(0, 0, 0); $pdf->Line(108, 0, 108, 279); $pdf->Line(0, 135, 215, 135); } $x = $count % 2 == 0 ? 5 : 115; $y = $count / 2 % 2 == 0 ? 10 : 145; $pdf->SetXY($x, $y); $tmp = explode(":", $toid); $tid = $tmp[0]; $oid = $tmp[1]; $r = $dbc->exec_statement($infoP, array($tid, $oid)); $w = $dbc->fetch_row($r); // flag item as "printed" $r2 = $dbc->exec_statement($flagP, array($tid, $oid)); $r3 = $dbc->exec_statement($idP, array($oid)); $o_count = 0; $rel_id = 1; while ($w3 = $dbc->fetch_row($r3)) { $o_count++; if ($w3['trans_id'] == $tid) { $rel_id = $o_count; } } $pdf->SetFont('Arial', '', '12'); $pdf->Text($x + 85, $y, "{$rel_id} / {$o_count}"); $pdf->SetFont('Arial', 'B', '24'); $pdf->Cell(100, 10, $w['name'], 0, 1, 'C'); $pdf->SetFont('Arial', '', '12'); $pdf->SetX($x); $pdf->Cell(100, 8, $w['fname'], 0, 1, 'C'); $pdf->SetX($x); if ($w['card_no'] != 0) { $pdf->Cell(100, 8, "Owner #" . $w['card_no'], 0, 1, 'C'); $pdf->SetX($x); } $pdf->SetFont('Arial', '', '16'); $pdf->Cell(100, 9, $w['description'], 0, 1, 'C'); $pdf->SetX($x); $pdf->Cell(100, 9, "Cases: " . $w['ItemQtty'] . ' - ' . $w['quantity'], 0, 1, 'C'); $pdf->SetX($x); $pdf->SetFont('Arial', 'B', '16'); $pdf->Cell(100, 9, sprintf("Total: \$%.2f", $w['total']), 0, 1, 'C'); $pdf->SetFont('Arial', '', '12'); $pdf->SetX($x); if ($w['discounttype'] == 1 || $w['discounttype'] == 2) { $pdf->Cell(100, 9, 'Sale Price', 0, 1, 'C'); $pdf->SetX($x); } elseif ($w['regPrice'] - $w['total'] > 0) { $percent = round(100 * (($w['regPrice'] - $w['total']) / $w['regPrice'])); $pdf->Cell(100, 9, sprintf("Owner Savings: \$%.2f (%d%%)", $w['regPrice'] - $w['total'], $percent), 0, 1, 'C'); $pdf->SetX($x); } $pdf->Cell(100, 6, "Tag Date: " . $date, 0, 1, 'C'); $pdf->SetX($x); $pdf->Cell(50, 6, "Dept #" . $w['department'], 0, 0, 'R'); $pdf->SetFont('Arial', 'B', '12'); $pdf->SetX($x + 50); $pdf->Cell(50, 6, $w['vendorName'], 0, 1, 'L'); $pdf->SetFont('Arial', '', '12'); $pdf->SetX($x); $pdf->Cell(100, 6, "Ph: " . $w['phone'], 0, 1, 'C'); $pdf->SetXY($x, $y + 85); $pdf->Cell(160, 10, "Notes: _________________________________"); $pdf->SetX($x); $upc = "454" . str_pad($oid, 6, '0', STR_PAD_LEFT) . str_pad($tid, 2, '0', STR_PAD_LEFT); $pdf = $signage->drawBarcode($upc, $pdf, $x + 30, $y + 95, array('height' => 14, 'fontsize' => 8)); $count++; } $pdf->Output(); return false; }
$pdf->Cell(150, 5, ''); $pdf->Cell(40, 5, $text['label-invoice_date'] . ' ' . $invoice_date); $pdf->Ln(); $pdf->Cell(150, 5, ''); $pdf->Cell(40, 5, $text['label-invoice_number'] . ' ' . $invoice_number); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); //set the vertical position $pdf->SetY(65); //table headers array $header = array($text['label-item_qty'], $text['label-item_desc'], $text['label-item_unit_price'], $text['label-item_amount']); //set the table header styles $pdf->SetFillColor(200, 200, 200); //$pdf->SetTextColor(255); $pdf->SetDrawColor(220, 220, 220); $pdf->SetLineWidth(0.3); //set the table cell widths $w[0] = 20; $w[1] = 120; $w[2] = 25; $w[3] = 25; for ($i = 0; $i < count($header); $i++) { if ($header[$i] == $text['label-item_desc']) { //left align $pdf->Cell($w[$i], 5, $header[$i], 1, 0, 'L', true); } else { //center $pdf->Cell($w[$i], 5, $header[$i], 1, 0, 'C', true); } }
function exportPDF($strsql, $product) { $mysql_server_name = SERVER_NAME; // mysql server name $mysql_username = USER_NAME; // mysql user name $mysql_password = USER_PASSWORD; // mysql user password $mysql_database = DB_NAME; // mysql database name $savename = date("Y-m-d H:i:s"); $conn = mysql_connect($mysql_server_name, $mysql_username, $mysql_password); // 从表中提取信息的sql语句 // 执行sql查询 $result = mysql_db_query($mysql_database, $strsql, $conn); // 获取查询结果 $row = mysql_fetch_row($result); $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 15); $pdf->SetFont('', 'B', '15'); $pdf->SetFillColor(255, 255, 255); $pdf->SetTextColor(128); $pdf->SetDrawColor(92, 92, 92); $pdf->SetLineWidth(0.3); $pdf->Write(40, $product); $pdf->Ln(); //title $pdf->SetFont('', 'B', '9'); $pdf->SetFillColor(128, 128, 128); $pdf->SetTextColor(255); $pdf->SetDrawColor(92, 92, 92); $pdf->SetLineWidth(0.3); // 显示字段名称 //echo "</b><tr></b>"; //$pdf->Cell(mysql_field_len($result, $i),7,mysql_field_name($result, $i),1,0,'C',true); $pdf->Cell(80, 8, 'Product', 1, 0, 'L', true); $pdf->Cell(80, 8, 'Sub-product', 1, 0, 'L', true); $pdf->Ln(); //contents $pdf->SetFillColor(255, 255, 255); $pdf->SetTextColor(128); $pdf->SetDrawColor(92, 92, 92); //echo "</tr></b>"; // 定位到第一条记录 mysql_data_seek($result, 0); // 循环取出记录 $tmp = 'tmp'; while ($row = mysql_fetch_row($result)) { //echo "<tr></b>"; for ($i = 0; $i < mysql_num_fields($result); $i++) { if ($i == 0 && $tmp == $row[$i]) { $pdf->Cell(80, 8, '', 1, 0, 'L', true); } elseif ($i == 0 && $tmp != $row[$i]) { $pdf->Cell(80, 8, $row[$i], 1, 0, 'L', true); $tmp = $row[$i]; } else { $pdf->Cell(80, 8, $row[$i], 1, 0, 'L', true); } } //echo "</tr></b>"; $pdf->Ln(); } $pdf->Output("{$savename}.pdf", 'D'); // release mysql_free_result($result); // disconnection mysql_close($conn); }
$pdf->Ln(5); $pdf->Write(6, "Level:" . $level_name); $pdf->Ln(5); $pdf->Write(6, "Class:" . $class_name); $pdf->Ln(5); $pdf->Write(6, "Subject:" . $subject_name); $pdf->Ln(5); $pdf->Write(6, "Module:" . $module_name); //print_r($data1); // Logo //$pdf->Image( $logoFile, $logoXPos, $logoYPos, $logoWidth ); // Report Name $pdf->SetFont('Arial', 'B', 24); $pdf->Ln($reportNameYPos); //$pdf->Cell( 0, 15, $reportName, 0, 0, 'C' ); $pdf->SetDrawColor($tableBorderColour[0], $tableBorderColour[1], $tableBorderColour[2]); //$pdf->Ln( 15 ); // Create the table header row $pdf->SetFont('Arial', 'B', 15); // "PRODUCT" cell $pdf->SetTextColor($tableHeaderTopProductTextColour[0], $tableHeaderTopProductTextColour[1], $tableHeaderTopProductTextColour[2]); $pdf->SetFillColor($tableHeaderTopProductFillColour[0], $tableHeaderTopProductFillColour[1], $tableHeaderTopProductFillColour[2]); $pdf->Cell(46, 12, $first_row, 1, 0, 'L', true); // Remaining header cells $pdf->SetTextColor($tableHeaderTopTextColour[0], $tableHeaderTopTextColour[1], $tableHeaderTopTextColour[2]); $pdf->SetFillColor($tableHeaderTopFillColour[0], $tableHeaderTopFillColour[1], $tableHeaderTopFillColour[2]); for ($i = 0; $i < count($columnLabels); $i++) { $pdf->Cell(36, 12, $columnLabels[$i], 1, 0, 'C', true); } $pdf->Ln(12); // Create the table data rows
/** * Changes the draw color * @param $color Color in RGB * @author Pablo Dall'Oglio */ public function setDrawColorRGB($color) { $drawc = $this->rgb2int255($color); parent::SetDrawColor($drawc[0], $drawc[1], $drawc[2]); }
<?php require "fpdf/fpdf.php"; $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont("Helvetica", "B", 22); $pdf->Cell(0, 20, "Certificate", "B", 1, "C"); $pdf->Ln(); $pdf->SetFont("Helvetica", "B", 16); $pdf->Cell(0, 20, "OF PHP Knowledge", "I", 0, "C"); $pdf->Ln(); $pdf->Cell(0, 20, "Issued to VitoshAcademy.Com", "I", 0, "C"); $pdf->Ln(); $pdf->Cell(0, 20, "By VitoshAcademy.Com", "I", 0, "C"); $pdf->Ln(); $pdf->SetFont("Helvetica", "B", 11); $pdf->SetDrawColor(255, 0, 255); $pdf->SetLineWidth(0.1); $pdf->SetFillColor(192, 192, 192); $pdf->SetTextColor(255, 0, 0); $pdf->Cell(25, 5, "N", "LTR", 0, "C", 1); $pdf->Cell(25.1, 5, "N * 11", "LTR", 0, "C", 1); $pdf->Cell(25.2, 5, "N * 13", "LTR", 0, "C", 1); $pdf->Cell(25.3, 5, "N * 17", "LTR", 0, "C", 1); $pdf->Cell(25.4, 5, "N * 19", "LTR", 0, "C", 1); $pdf->Cell(25.5, 5, "N * 23", "LTR", 0, "C", 1); $pdf->Cell(25.6, 5, "N * 31", "LTR", 0, "C", 1); $pdf->Ln(); $bool_draw = True; for ($w = 7; $w <= 50; $w = $w + 7) { if ($bool_draw == True) { $pdf->SetFillColor(105, 110, 115);
$part4 = array(); $part4[0] = ''; $serverTotal = array(); $serverTotal[0] = ''; $grandServerTotal = 0; $oneTimeTotal = 600; $pdf = new FPDF(); $pdf->AddPage(); $pdf->Image('./pdf/images/dss_logo.jpg'); $pdf->SetFont('Arial', '', '12'); $pdf->Cell(0, 10, 'Budgetary Quote for Hosting', 0, 1, 'C'); $pdf->Cell(0, 10, '**** This is not a formal proposal. Formal design required. ****', 0, 1, 'C'); $pdf->Cell(95, 10, 'Date: ' . date('m/d/y'), 0, 0, 'L'); $pdf->Cell(95, 10, 'Contact: ' . $salesperson, 0, 1, 'R'); $pdf->SetLineWidth(0.8); $pdf->SetDrawColor(160, 160, 160); $pdf->Line(10, 53, 200, 53); $pdf->SetFont('', 'B', '14'); $pdf->Cell(130, 15, 'Description', 0, 0, 'L'); $pdf->Cell(30, 15, 'Monthly', 0, 0, 'R'); $pdf->Cell(30, 15, 'One-Time', 0, 1, 'R'); $serversOnList = $_POST['servers-on-list']; if ($serversOnList == 0) { $pdf->SetFont('', 'I', '12'); $pdf->Cell(130, 5, 'No cloud server configurations', 0, 1, 'L'); } else { $driveTotal = 0; for ($i = 1; $i <= $serversOnList; ++$i) { $pdf->SetFont('', '', '12'); $pdf->Cell(130, 5, $_POST['server_name' . $i], 0, 0, 'L'); $a[$i] = $_POST['operating_system' . $i];
public function fee_month() { $date_from = $this->input->get("date_from"); $date_to = $this->input->get("date_to"); $event = $this->input->get("event"); require_once "../assets/fpdf/fpdf.php"; $pdf = new FPDF(); $pdf->AliasNbPages(); $pdf->AddPage('L', 'A4'); //title $pdf->SetFont('Arial', 'B', 16); $pdf->Cell(0, 10, 'Report Absensi Moderasi HM Sampoerna', 0, 0, 'C'); $pdf->Ln(10); $pdf->SetFont('Arial', '', 10); $pdf->Cell(0, 5, 'Periode Tanggal : ' . $date_from . ' s/d ' . $date_to, 0, 0, 'C'); $pdf->Ln(5); $pdf->Cell(0, 5, 'Event : ' . $this->event_model->get_event_name($this->input->get("event")), 0, 0, 'L'); $pdf->Ln(10); //header $pdf->SetFont('Arial', 'B', 8); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(10, 14, 'No', 1, 0, 'C'); $pdf->Cell(40, 14, 'Moderator', 1, 0, 'C'); $from = date_create(format_ymd($date_from)); $to = date_create(format_ymd($date_to)); $j = 0; while ($from <= $to) { $pdf->SetXY(60 + $j, 35); $pdf->Cell(6, 7, date_format($from, "d"), 1, 0, 'C'); $pdf->SetXY(60 + $j, 42); $pdf->Cell(6, 7, date_format($from, "m"), 1, 0, 'C'); date_add($from, date_interval_create_from_date_string('1 days')); $j += 6; } $pdf->SetXY($j + 60, 35); $pdf->Cell(0, 14, 'Jumlah', 1, 0, 'C'); $pdf->Ln(14); //rows $pdf->SetFont('Arial', '', 8); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $result = $this->user_event_model->get_user_month()->result(); $total = 0; $i = 1; $j = 0; foreach ($result as $r) { $pdf->Cell(10, 7, $i++, 1, 0, 'C'); $pdf->Cell(40, 7, $r->user, 1, 0, 'L'); $from = date_create(format_ymd($date_from)); $to = date_create(format_ymd($date_to)); $j = 0; $jum = 0; while ($from <= $to) { $jumlah = $this->absent_model->check_exist_month($r->user_kode, $event, date_format($from, 'Y-m-d')); $pdf->Cell(6, 7, number_format($jumlah), 1, 0, 'C'); $jum += $jumlah; date_add($from, date_interval_create_from_date_string('1 days')); $j++; } $pdf->Cell(0, 7, number_format($jum), 1, 0, 'C'); $total += $jum; $pdf->Ln(7); } $pdf->SetFillColor(240, 240, 240); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(50 + 6 * $j, 7, 'Total : ', 1, 0, 'R', true); $pdf->Cell(0, 7, number_format($total), 1, 0, 'C', true); $pdf->SetFont('Arial', '', 10); $this->_footer($pdf); $pdf->Output("Fee Moderasi HM Sampoerna", "I"); }
$pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['tel'])), 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['siret'] . " " . $info_veto[0]['num_tva']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['siret'] . " " . $info_veto[0]['num_tva'])), 0, 'C'); $pdf->Ln(35); $pdf->Cell(90); $pdf->MultiCell(85, 5, requetemysql::gestion_string_maj($info_client[0]['nom']) . ' ' . requetemysql::gestion_string_norm($info_client[0]['prenom']) . "\n" . requetemysql::gestion_string_norm($info_client[0]['adresse']) . "\n" . requetemysql::gestion_string_norm($info_client[0]['code']) . ' ' . requetemysql::gestion_string_norm($info_client[0]['ville']), 0, 'C'); $pdf->Ln(15); $pdf->MultiCell(85, 5, "Le " . date("d.m.y"), 0, 'L'); $pdf->MultiCell(85, 5, requetemysql::gestion_string_maj("Document édité par " . $_SESSION['login2'] . " et validé par " . $print_reglement_veto['nom']), 0, 'L'); $pdf->SetFont('Times', '', 18); $pdf->SetFillColor(153, 153, 153); $pdf->SetTextColor(0, 0, 0); $pdf->SetDrawColor(153, 153, 153); $pdf->SetLineWidth(0.3); $pdf->SetFont('', 'B'); $pdf->MultiCell(0, 12, utf8_decode("Facture N°" . date("d_m_y") . uniqid() . " pour la période du :" . $_POST['debut2'] . " au " . $_POST['fin2']), 0, '', true); $pdf->SetFont('Times', '', 12); $pdf->MultiCell(0, 7, requetemysql::gestion_string_maj("Facture correspondant aux actes effectués pour le compte de :" . $info_client[0]['nom'] . " par le Docteur " . utf8_decode(stripslashes($info_veto[0]['nom'])) . " conformément aux accords sur les taux de rétrocession contractuels : "), 0, 'L'); $pdf->Ln(); $pdf->MultiCell(0, 12, utf8_decode("% : pourcentage de rétrocession (en pour-cent)"), 0, 'L'); // Largeurs des colonnes $w = array(190 / 8, 190 / 10, 190 / 8, 190 / 10, 190 / 8, 190 / 10, 190 / 5); $header = array(utf8_decode('acte ht'), utf8_decode('% acte'), utf8_decode('medic ht'), utf8_decode('% medic'), utf8_decode("repartition ht"), utf8_decode("% repar"), utf8_decode("TOTAL")); // En-tête for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C'); } $pdf->Ln();
// $this->SetTextColor(120,120,120); // // Posición: a 1,5 cm del final // $this->SetY(-20); // // Arial italic 8 // $this->SetFont('Arial','',6); // //calculo las palabras que tiene el texto } } // Creación del objeto de la clase heredada //$pdf = new PDF(); $pdf = new FPDF('L', 'mm', 'A4'); //print_r($pdf->datosPresupuesto);die; $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 9); $pdf->SetDrawColor(0, 0, 0); $pdf->Ln(); $pdf->Ln(); // Fondo $pdf->Image("../images/fondo.gif", 0, 30, 297, 180); // Logo $pdf->Image("../qualidad/doc-" . $_SESSION['base'] . "/logo-certificado.jpg", 10, 12, 60, 30); // 2/1 proporcional // Salto de línea $pdf->Ln(25); $altura = 10; $fill = false; $espacioBlancoIzda = 70; $pdf->SetFillColor(255, 255, 255); $pdf->SetDrawColor(200, 200, 200); $pdf->SetLineWidth(0.1);
require_once "fpdf/fpdf.php"; $pdf = new FPDF(); $pdf->AddPage(); #tampilkan judul laporan $pdf->SetFont('Arial', 'B', '12'); $pdf->Cell(0, 20, $judul, '0', 1, 'C'); $mydate = getdate(date("U")); $pdf->SetFont('Arial', 'B', '10'); $pdf->Cell(0, 10, "{$mydate['weekday']}, {$mydate['month']} {$mydate['mday']}, {$mydate['year']}", '0', 1, 'C'); $pdf->SetFont('Arial', 'B', '10'); $pdf->Cell(0, 20, $tulis_total, '0', 1, 'L'); #buat header tabel $pdf->SetFont('Arial', '', '10'); $pdf->SetFillColor(128, 0, 0); $pdf->SetTextColor(255); $pdf->SetDrawColor(20, 10, 0); foreach ($header as $kolom) { $pdf->Cell($kolom['length'], 7, $kolom['label'], 1, '0', $kolom['align'], true); } $pdf->Ln(); #tampilkan data tabelnya $pdf->SetFillColor(224, 235, 255); $pdf->SetTextColor(0); $pdf->SetFont(''); $fill = false; foreach ($data as $baris) { $i = 0; foreach ($baris as $cell) { $pdf->Cell($header[$i]['length'], 7, $cell, 1, '0', $kolom['align'], $fill); $i++; }
$pdf = new FPDF(); $pdf->AddPage(); #tampilkan judul laporan $subjudul="Tanggal ".$t1." - ".$t2; $pdf->SetFont('Courier','B','16'); $pdf->Cell(0,7, $judul, '0', 1, 'C'); $pdf->SetFont('Courier','B','12'); $pdf->Cell(0,20, $subjudul, '0', 1, 'C'); #buat header tabel $pdf->SetFont('Courier','','10'); $pdf->SetFillColor(65,65,65); $pdf->SetTextColor(255); $pdf->SetDrawColor(204,204,204); $pdf->Cell(10, 5, 'NO', 1, '0', 'L', true); foreach ($header as $kolom) { $pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0', $kolom['align'], true); } $pdf->Ln(); #tampilkan data tabelnya $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); $fill=false; $no=1;
function set_draw_color($r, $g, $b) { parent::SetDrawColor($r, $g, $b); }
} //setting judul laporan dan header tabel $judul = "LAPORAN DATA MAHASISWA"; $header = array(array("label" => "No. Pegawai", "length" => 30, "align" => "L"), array("label" => "Nama", "length" => 50, "align" => "L"), array("label" => "Email", "length" => 40, "align" => "L"), array("label" => "Telepon", "length" => 30, "align" => "L"), array("label" => "Jenis Kelamin", "length" => 30, "align" => "L")); //sertakan library FPDF dan bentuk objek require_once "fpdf/fpdf.php"; $pdf = new FPDF(); $pdf->AddPage(); //tampilkan judul laporan $pdf->SetFont('Arial', 'B', '16'); $pdf->Cell(0, 20, $judul, '0', 1, 'C'); //buat header tabel $pdf->SetFont('Arial', '', '10'); $pdf->SetFillColor(11, 11, 11); $pdf->SetTextColor(255); $pdf->SetDrawColor(11, 11, 11); foreach ($header as $kolom) { $pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0', $kolom['align'], true); } $pdf->Ln(); //tampilkan data tabelnya $pdf->SetFillColor(224, 235, 255); $pdf->SetTextColor(0); $pdf->SetFont(''); $fill = false; foreach ($data as $baris) { $i = 0; foreach ($baris as $cell) { $pdf->Cell($header[$i]['length'], 5, $cell, 1, '0', $kolom['align'], $fill); $i++; }
$pdf->SetFont(''); $pdf->SetFontSize(10); $pdf->Cell(50, 7, $header['Direccion']); $pdf->SetFont('', 'B', 12); $pdf->Cell(50, 7, 'Email: '); $pdf->SetFont(''); $pdf->SetFontSize(10); $pdf->Cell(50, 7, $header['Email']); $pdf->SetFont('', 'B', 12); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); //================================================================= $pdf->SetFillColor(255); $pdf->SetTextColor(0); $pdf->SetDrawColor(0); $pdf->SetLineWidth(0.3); $pdf->SetFont('', 'B', 10); // Cabecera tabla $pdf->Cell(30, 7, 'Referencia', 1, 0, 'C', true); $pdf->Cell(79, 7, 'Nombre Producto', 1, 0, 'C', true); $pdf->Cell(18, 7, 'Cantidad', 1, 0, 'C', true); $pdf->Cell(25, 7, 'Valor Unidad', 1, 0, 'C', true); $pdf->Cell(38, 7, 'Valor Total', 1, 0, 'C', true); $pdf->Ln(); // Restauración de colores y fuentes $pdf->SetFillColor(224, 235, 255); $pdf->SetTextColor(0); $pdf->SetFont(''); $pdf->SetFontSize(8); // Datos