示例#1
2
 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);
 }
示例#2
1
文件: base.php 项目: kit9/surat
 /**
  *
  * View detail of persuratan_suratmasuk
  *
  **/
 function action_persuratan_suratmasukcetakld($id)
 {
     $this->blankpage = true;
     $this->db_query("SELECT * FROM persuratan_ms_flowstat");
     while ($row = $this->db_fetch()) {
         $arr_ms_flowstat[$row['id']] = $row['name'];
     }
     $this->db_query("SELECT * FROM persuratan_ms_tipesurat");
     while ($row = $this->db_fetch()) {
         $arr_ms_tipesurat[$row['id']] = $row['name'];
     }
     $this->db_query("SELECT * FROM persuratan_ms_sifatsurat");
     while ($row = $this->db_fetch()) {
         $arr_ms_sifatsurat[$row['id']] = $row['name'];
     }
     $this->db_query("SELECT * FROM persuratan_ms_tujuanakhir");
     while ($row = $this->db_fetch()) {
         $arr_ms_tujuanakhir[$row['id']] = $row['name'];
     }
     $res = $this->db_query("SELECT * , DATE_FORMAT(tglagenda, '%d-%m-%Y') AS tglagenda, DATE_FORMAT(tglsuratintern, '%d-%m-%Y') AS tglsuratintern, DATE_FORMAT(tglkma, '%d-%m-%Y') AS tglkma, DATE_FORMAT(tglsuratpengirim, '%d-%m-%Y') AS tglsuratpengirim, DATE_FORMAT(tglpembukuan, '%d-%m-%Y') AS tglpembukuan, DATE_FORMAT(tglmasuktuadawas, '%d-%m-%Y') AS tglmasuktuadawas, DATE_FORMAT(tglkeluar, '%d-%m-%Y') AS tglkeluar FROM persuratan_suratmasuk \n            WHERE ms_tujuanakhir_id='{$id}' AND ms_flowstat_id = 101\n                {$this->groupfield} ORDER BY tglagenda DESC");
     $this->db_query("SELECT * , DATE_FORMAT(tglagenda, '%d-%m-%Y') AS tglagenda, DATE_FORMAT(tglsurat, '%d-%m-%Y') AS tglsurat FROM persuratan_suratmasuk WHERE ms_tujuanakhir_id='{$id}' AND ms_flowstat_id = 101 {$this->groupfield} ORDER BY tglagenda DESC, id DESC");
     if ($this->db_numrows() > 0) {
         //==============
         // Start create PDF
         //==============
         require 'fpdf/fpdf.php';
         $pdf = new FPDF('P', 'mm', array(215, 330));
         $pdf->SetAuthor('Agus Sudarmanto, S.Kom.');
         while ($row = $this->db_fetch()) {
             $pdf->AddPage();
             $pdf->SetFont('Arial', 'B', 16);
             $cellBox = 195;
             $pdf->Rect(10, 7, $cellBox, 25);
             $pdf->Rect(10, 38, $cellBox, 24);
             $pdf->Rect(150, 38, 55, 24);
             $pdf->Rect(10, 62, $cellBox, 50);
             $pdf->Rect(10, 118, $cellBox, 133);
             $pdf->Rect(150, 118, 55, 133);
             $pdf->Cell($cellBox, 7, 'MAHKAMAH AGUNG REPUBLIK INDONESIA', 0, 1, 'C');
             $pdf->Cell($cellBox, 7, 'SEKRETARIAT WAKIL KETUA MA BIDANG NON YUDISIAL', 0, 1, 'C');
             $pdf->SetFont('Arial', 'B', 12);
             $pdf->Cell($cellBox, 7, 'Lembar Disposisi', 0, 1, 'C');
             $pdf->Image('pdf/logo.png', 23, 10, 16);
             $pdf->SetFont('Arial', '', 10);
             $arr = array(array('Nomor Agenda', $row[noagenda]), array('Tanggal Agenda', $row[tglagenda]), array('Agno TU', $row[nosuratintern]), array('Tanggal TU', $row[tglsuratintern]), array('', ''), array('Nomor Surat', $row[nosuratpengirim]), array('Tanggal', $row[tglsuratpengirim]), array('Pengirim', $row[namapengirim]), array('Perihal', $row[perihal]));
             $pdf->SetY(40);
             for ($i = 0, $c = sizeof($arr); $i < $c; $i++) {
                 $pdf->SetX(13);
                 $pdf->Cell(31, 5, $arr[$i][0]);
                 $pdf->Cell(5, 5, !in_array($i, array(4, 9)) ? ':' : '');
                 $pdf->MultiCell($i < 5 ? 100 : 158, 5, $arr[$i][1], 0, 1);
             }
             $pdf->SetY(45);
             $arr = array(array('Jenis Surat', $arr_ms_sifatsurat[$row['ms_sifatsurat_id']]));
             for ($i = 0, $c = sizeof($arr); $i < $c; $i++) {
                 $pdf->SetX(155);
                 $pdf->Cell(20, 5, $arr[$i][0]);
                 $pdf->Cell(5, 5, ':');
                 if ($i == 0) {
                     $pdf->SetFont('', 'B');
                 }
                 $pdf->MultiCell(70, 5, $arr[$i][1], 0, 1);
                 if ($i == 0) {
                     $pdf->SetFont('', '');
                 }
             }
             $arr = array(array('Diteruskan kepada :'), array('KMA RI'), array('WKMA RI Bid. Yud'), array('WKMA RI Bid. Non Yud'), array('Para Tuaka'), array('Kabawas'), array('Lainnya'));
             $pdf->SetY(120);
             for ($i = 0, $c = sizeof($arr); $i < $c; $i++) {
                 $pdf->SetX($i == 0 ? 155 : 163);
                 $pdf->Cell(31, 7, $arr[$i][0], 0, 1);
             }
             $pdf->SetFont('Arial', '', 8);
             $pdf->SetY(251);
             for ($i = 0; $i < 6; $i++) {
                 $pdf->Rect(157, 128 + $i * 7, 4, 4);
             }
             $pdf->SetY(150);
             $pdf->SetX(130);
         }
         $pdf->Output();
         $res = $this->db_query("UPDATE persuratan_suratmasuk \n                SET ms_flowstat_id = 102\n                WHERE ms_tujuanakhir_id='{$id}' AND ms_flowstat_id = 101");
     }
 }
示例#3
1
	/**
	 * 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);
	}
示例#4
0
function UsersTrafficPeriodPDF()
{
    //require('chart.php');
    require 'lib/fpdf.php';
    global $SAMSConf;
    global $DATE;
    $DB = new SAMSDB();
    $sdate = $DATE->sdate();
    $edate = $DATE->edate();
    $bdate = $DATE->BeginDate();
    $eddate = $DATE->EndDate();
    $size = "";
    if (isset($_GET["size"])) {
        $size = $_GET["size"];
    }
    require "reportsclass.php";
    $dateselect = new DATESELECT($DATE->sdate(), $DATE->edate());
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    define('FPDF_FONTPATH', 'lib/font/');
    require 'lib/fpdf.php';
    $pdfFile = new FPDF();
    $pdfFile->Open();
    $pdfFile->AddFont('Nimbus', '', 'Nimbus.php');
    $pdfFile->SetAuthor("SQUID Account Management System");
    $pdfFile->SetCreator("Created by SAMS2");
    $pdfFile->SetTitle("SAMS2 users statistic");
    //      UsersTrafficPeriodPDF();
    $pdfFile->AddPage();
    $pdfFile->SetFont('Nimbus', '', 15);
    //$pdfFile->SetFont('SUSESerif-Roman','',16);
    $pdfFile->SetXY(50, 15);
    echo " {$usersbuttom_2_traffic_UsersTrafficPeriod_1}<BR>{$usersbuttom_2_traffic_UsersTrafficPeriod_2}<br>";
    $pdfFile->Write(0, " {$usersbuttom_2_traffic_UsersTrafficPeriod_1}<BR>{$usersbuttom_2_traffic_UsersTrafficPeriod_2}");
    $pdfFile->Output();
}
示例#5
0
/**
 * @brief Create PDF for a reference
 *
 * We create a simple cover page for the PDF. This page contains basic bibliographic metadata
 * for the PDF, in order for Mendeley to process the PDF correctly. In response to my discovery
 * that Mendeley doesn't accept all XMP (Ticket#2010040110000015) support@mendeley.com replied that
 * they have some heuristic tests to see if the metadata is valid, such as whether the information 
 * about the title and authors occurs on the first of the PDF.
 *
 *
 * @param reference_id Reference id
 * @param pdf_filename Full path of PDF file to create
 *
 */
function pdf_create($reference_id, $pdf_filename)
{
    global $config;
    // Get reference
    $reference = db_retrieve_reference($reference_id);
    // Get tags
    $tags = pdf_tags($reference->reference_id, 10);
    // Paper size
    // A4 = 210 x 297
    $paper_width = 210;
    // mm
    $paper_height = 297;
    // mm
    $margin = 10;
    //----------------------------------------------------------------------------------------------
    // PDF
    $pdf = new FPDF('P', 'mm', 'A4');
    //$pdf = PDF_Rotate('P', 'mm', 'A4');
    //----------------------------------------------------------------------------------------------
    // Basic metadata (e.g., that displayed by Mac OS X Preview)
    $pdf->SetTitle($reference->title, true);
    // true means use UTF-8
    $pdf->SetAuthor(reference_authors_to_text_string($reference), true);
    // true means use UTF-8
    if (count($tags) > 0) {
        $pdf->SetKeywords(join(", ", $tags), true);
    }
    //----------------------------------------------------------------------------------------------
    // Cover page (partly to ensure Mendeley accepts XMP metadata)
    $pdf->AddPage();
    // Title
    $pdf->SetFont('Arial', '', 24);
    $pdf->SetXY($margin, $margin);
    $pdf->Write(10, utf8_decode($reference->title));
    // Authors
    $y = $pdf->GetY();
    $pdf->SetXY($margin, $y + 16);
    $pdf->SetFont('Arial', 'B', 16);
    $pdf->Write(6, utf8_decode(reference_authors_to_text_string($reference)));
    // Citation
    $y = $pdf->GetY();
    $pdf->SetXY($margin, $y + 10);
    $pdf->SetFont('Arial', 'I', 12);
    $pdf->Write(6, utf8_decode($reference->secondary_title));
    $pdf->SetFont('Arial', '', 12);
    $pdf->Write(6, ' ' . $reference->volume);
    if (isset($reference->issue)) {
        $pdf->Write(6, '(' . $reference->issue . ')');
    }
    $pdf->Write(6, ':' . $reference->spage);
    if (isset($reference->epage)) {
        $pdf->Write(6, '-' . $reference->epage);
    }
    $pdf->Write(6, ' (' . $reference->year . ')');
    // URL
    $url = $config['web_root'] . 'reference/' . $reference->reference_id;
    $pdf->Write(6, ' ');
    $pdf->SetTextColor(0, 0, 255);
    $pdf->SetFont('', 'U');
    $pdf->Write(6, $url, $url);
    $pdf->SetFont('', '');
    $pdf->SetTextColor(0, 0, 0);
    //----------------------------------------------------------------------------------------------
    // If we add taxon names as keywords
    if (count($tags) > 0) {
        $keywords = "Keywords: " . join("; ", $tags);
        $y = $pdf->GetY();
        $pdf->SetXY($margin, $y + 10);
        $pdf->Write(6, $keywords);
    }
    //----------------------------------------------------------------------------------------------
    // Footer giving credit to BHL
    $y = $paper_height;
    $y -= $margin;
    $y -= 40;
    $pdf->Image($config['web_dir'] . '/images/cc/cc.png', 10, $y, 10);
    $pdf->Image($config['web_dir'] . '/images/cc/by.png', 20, $y, 10);
    $pdf->Image($config['web_dir'] . '/images/cc/nc.png', 30, $y, 10);
    $pdf->SetXY(10, $y + 10);
    $pdf->SetFont('Arial', '', 10);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->Write(6, 'Page images from the Biodiversity Heritage Library, ');
    //Then put a blue underlined link
    $pdf->SetTextColor(0, 0, 255);
    $pdf->SetFont('', 'U');
    $pdf->Write(6, 'http://www.biodiversitylibrary.org/', 'http://www.biodiversitylibrary.org/');
    $pdf->SetFont('', '');
    $pdf->SetTextColor(0, 0, 0);
    $pdf->Write(6, ', made available under a Creative Commons Attribution-Noncommercial License ');
    $pdf->SetTextColor(0, 0, 255);
    $pdf->SetFont('', 'U');
    $pdf->Write(6, 'http://creativecommons.org/licenses/by-nc/2.5/', 'http://creativecommons.org/licenses/by-nc/2.5/');
    //----------------------------------------------------------------------------------------------
    // Add BHL page scans
    $pages = bhl_retrieve_reference_pages($reference_id);
    foreach ($pages as $page) {
        $image = bhl_fetch_page_image($page->PageID);
        $page_width = $paper_width;
        $page_height = $paper_height;
        $page_width -= 2 * $margin;
        $page_height -= 2 * $margin;
        // Fit to page
        $img_height = $image->height;
        $img_width = $image->width;
        $w_scale = $page_width / $img_width;
        $h_scale = $page_height / $img_height;
        $scale = min($w_scale, $h_scale);
        $img_height *= $scale;
        $img_width *= $scale;
        $pdf->AddPage();
        $x_offset = ($paper_width - $img_width) / 2.0;
        $y_offset = ($paper_height - $img_height) / 2.0;
        $pdf->Image($image->file_name, $x_offset, $y_offset, $img_width);
    }
    $pdf->Output($pdf_filename, 'F');
    pdf_add_xmp($reference, $pdf_filename, $tags);
}
示例#6
0
文件: fpdfout.php 项目: JLockerbie/BS
<?php

$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();
<?php

// advancedII/pdf/teste.php
require_once 'meupdf.php';
$pdf = new FPDF('P', 'cm', 'A4');
$pdf->SetAuthor('GerenciaNet');
$pdf->SetTitle('Meu Primeiro Documento PDF');
$pdf->SetMargins(2, 2, 1);
$pdf->AliasNbPage('{nb}');
$pdf->AddPage();
// tentar adicionar um footer, adicionar a página, e tentar adicionar um header na nova página
$produtos = array(array('nome' => 'Lixa de unha reutilizável', 'marca' => 'Treco', 'preco' => 10.5), array('nome' => 'Escova de Dentes Multiuso', 'marca' => 'OralBJ', 'preco' => 12), array('nome' => 'Refrigerante de Cachaça', 'marca' => 'Companhia das Índias Antigas', 'preco' => 4.5));
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(8, 1, 'Nome do Produto', 1, 0, 'C');
$pdf->Cell(5, 1, 'Marca', 1, 0, 'C');
$pdf->Cell(5, 1, 'Preço', 1, 0, 'C');
$pdf->Ln(1);
$pdf->SetFont('Arial', '', 11);
foreach ($produtos as $produto) {
    $pdf->Cell(8, 1, $produto['nome'], 1, 0, 'C');
    $pdf->Cell(5, 1, $produto['marca'], 1, 0, 'C');
    $pdf->Cell(5, 1, $produto['preco'], 1, 0, 'C');
    $pdf->Ln(1);
}
$pdf->Output('first.pdf', 'I');
示例#8
0
<?php

session_start();
if ($_SESSION['access'] == 1) {
    require '../includes/fpdf.php';
    $pdf = new FPDF();
    $pdf->SetAuthor('ISP');
    $pdf->SetTitle('Memoloi Projet');
    $pdf->SetFont('Helvetica', 'B', 20);
    $pdf->SetTextColor(50, 60, 100);
    foreach ($_SESSION['images'] as $j) {
        $pdf->AddPage();
        $pdf->Image("{$j}", 0, 0, 210, 297, 'JPG');
        $pdf->Ln(2.0);
    }
    $pdf->Output();
    unset($_SESSION['images']);
} else {
    header('Location: index.php?login=error');
}
?>

示例#9
0
文件: fp.php 项目: sipsenachi/rep
$stmt = $cnx->prepare($sql);
$stmt->execute();
//$sql="INSERT INTO `tempinc` SELECT * FROM `NC` WHERE PAR='$par'";
//$stmt=$cnx->prepare($sql);
//$stmt->execute();
//$stmt=$cnx->prepare($sql);
//$stmt->execute();
//$sql="SELECT * FROM INC FOR PAR='$par'";
//$stmt=$cnx->prepare($sql);
//$stmt->execute();
//$res = $stmt->fetch(PDO::FETCH_OBJ);
require 'fpdf.php';
//create a FPDF object
$pdf = new FPDF();
//set document properties
$pdf->SetAuthor('CORCIOVA ENACHI');
$pdf->SetTitle('FISA PARTIDEI');
//set font for the entire document
$pdf->SetFont('Helvetica', 'B', 10);
//$pdf->SetTextColor(50,60,100);
//set up a page
$pdf->AddPage('P');
//$pdf->SetDisplayMode(real,'default');
//display the title with a border around it
//$pdf->SetXY(50,20);
//$pdf->SetDrawColor(50,60,100);
$pdf->Write(7, 'CASA DE AJUTOR RECIPROC A PENSIONARILOR DIN FOCSANI SI JUDETUL VRANCEA');
//$pdf->Ln(2);
$pdf->SetFont('Helvetica', 'B', 12);
$pdf->SetXY(10, 15);
//$pdf->Ln(3);
$pedidoDAO = new PedidoDAO();
$atividadeDAO = new AtividadeDAO();
foreach ($p_id_pedido_item as $chave => $id_pedido_item) {
    $valida = valida_numero($id_pedido_item);
    if ($valida != 'TRUE') {
        echo 'Ocorreu um erro ao validar o número dos pedido(s) selecionado(s). O número
de um dos pedidos não é válido';
        exit;
    }
    if ($anexar == 'on') {
        $pdf = new FPDF('P', 'cm', 'A4');
        //papel personalizado
        $pdf->Open();
        $pdf->SetMargins(1, 2);
        //seta as margens do documento
        $pdf->SetAuthor('Vsites 2009');
        $pdf->SetFont('times', '', 7);
        $pdf->SetDisplayMode(100, 'continuous');
        //define o nivel de zoom do documento PDF
        $coluna = 0;
        $linha = 0;
        $posicaoH = 0;
        $posicaoV = 0;
    }
    $bloco = '';
    $ped = $pedidoDAO->selecPedidoPorIdOficio($id_pedido_item, $controle_id_empresa);
    if ($ped->id_pedido != '') {
        $linha_bloco = 1;
        $ordem = $ped->ordem;
        $id_pedido = $ped->id_pedido;
        $id_servico = $ped->id_servico;
$listOfSignatories["name"] = $signatorial_model->getSign_Name();
$listOfSignatories["id"] = $signatorial_model->getSign_ID();
$clearance_model = new ClearanceStatus();
foreach ($listOfSignatories["id"] as $key => $value) {
    $status = $clearance_model->getOverallSignatoryClearanceStatus($stud_id, $value, $current_sysemID);
    if ($status == "No Requirements") {
        $status = "Cleared";
    }
    $listOfSignatories["status"][$key] = $status;
}
//var_dump($listOfSignatories);
$fpdf = new FPDF('P', 'mm', 'Legal');
$fpdf->SetDisplayMode('fullpage', 'continuous');
$fpdf->SetTitle("SOCS Clearance - Export Copy");
$fpdf->SetCreator("USEP SOCS");
$fpdf->SetAuthor("University of Southeastern Philippines");
$fpdf->SetSubject("Electronic Clearance (export copy)");
$fpdf->SetMargins(15, 15, 15);
$fpdf->AddPage();
$fpdf->SetY('15');
$fpdf->Image('logo.jpg', 13, $fpdf->GetY() - 5, 25);
printBody();
$fpdf->Cell(0, 0, "Registrar's Copy", 0, 1, 'R', false);
$fpdf->Ln(4);
$fpdf->Cell(0, 0, "", 1, 1, 'L', true);
$fpdf->Ln(4);
$fpdf->Cell(0, 0, "Adviser's Copy", 0, 1, 'R', false);
$fpdf->SetY($fpdf->GetY() + 10);
$fpdf->Image('logo.jpg', 13, $fpdf->GetY() - 5, 25);
printBody();
function printBody()
示例#12
0
<?php

require 'skripte/fpdf/fpdf.php';
$con = mysqli_connect("localhost", "root", "root", "dwalabosi") or die("Neuspjelo spajanje na bazu!");
$baza = mysqli_select_db($con, "proizvodi");
$link1 = mysqli_query($con, "SET NAMES 'utf8'");
$link2 = mysqli_query($con, "SET CHARACTER_SET 'utf8'");
$naziv = $_POST['naziv'];
$tip = $_POST['tip'];
$pdf = new FPDF();
$pdf->SetAuthor('Alen Meštrov');
$pdf->SetFont('Helvetica', 'B', 20);
$pdf->SetTextColor(50, 60, 100);
$pdf->AddPage('P');
$pdf->SetXY(0, 10);
$pdf->SetDrawColor(50, 60, 100);
$pdf->Cell(210, 10, 'Popis proizvoda', 1, 0, 'C', 0);
$pdf->SetXY(5, 25);
$pdf->SetFontSize(10);
$pdf->Cell(50, 10, 'Naziv', 0, 0, 'L', 0);
$pdf->Cell(50, 10, 'Tip', 0, 0, 'L', 0);
$pdf->Cell(50, 10, 'Opis', 0, 0, 'L', 0);
$popis = array();
$query = "SELECT * FROM proizvodi WHERE naziv = '{$naziv}' OR tip = '{$tip}'";
$result = mysqli_query($con, $query);
$y_axis = 30;
$row_height = 6;
$y_axis = $y_axis + $row_height;
while ($row = mysqli_fetch_array($result)) {
    $pdf->SetY($y_axis);
    $pdf->SetX(5);
示例#13
0
文件: export_pdf.php 项目: Zilus/cms
$plot = new PHPlot();
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetShading(0);
$plot->SetDataValues($data1);
$plot->SetFileFormat('png');
$plot->SetIsInline(true);
$plot->PHPlot(1200, 550, "images/tmp/img7.png");
$plot->DrawGraph();
$img7 = "images/tmp/img7.png";
//en consesionario
/** PDF **/
$pdf = new FPDF('L', 'mm', 'Letter');
$title = 'Incidencias Generales';
$pdf->SetTitle($title);
$pdf->SetAuthor('Loop Media');
$pdf->AddPage();
//bg
$pdf->Image('images/pdf_bg.jpg', 0, 0, $pdf->w, $pdf->h);
//tittulo
$pdf->SetFont('Times', '', 42);
$pdf->SetTextColor(250, 250, 250);
$pdf->SetY(15);
$pdf->Cell(0, 10, utf8_decode('Reporte de Incidencias'), 0);
//subtitulo
$pdf->SetFont('Times', '', 32);
$pdf->SetTextColor(76, 76, 76);
$pdf->SetY(28);
$pdf->Cell(0, 10, utf8_decode('Estadísticas Generales'), 0);
$pdf->AddPage();
//head
示例#14
0
文件: sbr.php 项目: amage/fl-ru-damp
 /**
  * Генерирует PDF-документ на основании XML-файла.
  *
  * @param string $file          Файл для обработки
  * @param mixed $replacements   массив для подстановки значений
  * @return FPDF сформированный документ PDF или FALSE в случае неудачи
  */
 public static function xml2pdf($file, $replacements = false)
 {
     // Новая обработка PDF
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/odt2pdf.php';
     $tpl = basename($file, ".xml") . ".odt";
     $t = new odt2pdf($tpl);
     $t->convert($replacements);
     return $t;
     /**
      * @deprecated
      */
     if (!file_exists($file)) {
         return false;
     }
     require_once dirname(__FILE__) . '/fpdf/fpdf.php';
     define('FPDF_FONTPATH', dirname(__FILE__) . '/fpdf/font/');
     if (is_array($replacements)) {
         foreach ($replacements as &$val) {
             $val = htmlspecialchars_decode($val, ENT_QUOTES);
         }
     }
     $replacements['$tab'] = '    ';
     $xml = new DOMDocument('1.0', 'windows-1251');
     $xml->load($file);
     $pdf = new FPDF();
     // Загружаем шрифты
     $pdf->AddFont('ArialMT', '', 'c9bb7ceca00657d007d343f4e34b71a8_arial.php');
     $pdf->AddFont('Arial-BoldMT', '', '9cb9fc616ba50d7ecc7b816984f2ffda_arialbd.php');
     $pdf->AddFont('TimesNewRomanPSMT', '', '5f37f1915715e014ee2254b95c0b6cab_times.php');
     $pdf->AddFont('TimesNewRomanPS-BoldMT', '', 'e07f6c05a47ebec50a80f29789c7f1f6_timesbd.php');
     /*
             Загружаем XML-документ и читаем из него основные параметры лоя итогового PDF-документа
     */
     $root = $xml->documentElement;
     $title = $root->getAttribute('title') ? iconv('windows-1251', 'utf-8', $root->getAttribute('title')) : '';
     // заголовок документа
     $author = $root->getAttribute('author');
     // автор
     $margin_left = $root->getAttribute('margin-left') ? $root->getAttribute('margin-left') : 20;
     // отступ слева
     $margin_right = $root->getAttribute('margin-right') ? $root->getAttribute('margin-right') : 20;
     // отступ справа
     $margin_top = $root->getAttribute('margin-top') ? $root->getAttribute('margin-top') : 20;
     // отступ сверху
     $font_name = $root->getAttribute('font-name') ? $root->getAttribute('font-name') : 'ArialMT';
     // дефолтный шрифт (имя)
     $font_size = (int) $root->getAttribute('font-size') ? (int) $root->getAttribute('font-size') : 10;
     // дефолтный шрифт (размер)
     $text_width = (int) $root->getAttribute('width') ? (int) $root->getAttribute('width') : 170;
     // ширина печатной области документа
     $paragraph_indent = (int) $root->getAttribute('paragraph-indent') ? (int) $root->getAttribute('paragraph-indent') : 0;
     // отступ между параграфами
     $printable = $pdf->h - $margin_top - 20;
     $pdf->SetTitle($title, true);
     $pdf->SetAuthor($author);
     $pdf->SetLeftMargin($margin_left);
     $pdf->SetRightMargin($margin_right);
     $pdf->SetTopMargin($margin_top);
     $pdf->AddPage();
     $pdf->SetFont($font_name, '', $font_size);
     $pdf->SetX($margin_left);
     $locates = array();
     // разбор XML-документа
     $xpath = new DOMXPath($xml);
     $scale = $xpath->query('/document/page/*');
     if ($scale->length) {
         $footer = $xpath->query('//footer');
         $footer = $footer->length ? $footer->item(0) : NULL;
         $no_brake = $xpath->query('//nobreak');
         $no_brake = $no_brake->length ? TRUE : FALSE;
         // если есть теги <nobreak>, то расставляем разрывы страниц руками
         if ($no_brake) {
             $pdf->SetAutoPageBreak(false);
         }
         $last_y = 0;
         $pages = array();
         foreach ($scale as $node) {
             $last_y = intval($pdf->y);
             if ($node->tagName == 'nobreak' && $node->getAttribute('start')) {
                 $max_h = $last_y;
                 $loc_offset = 0;
                 foreach ($xpath->query('//cell|locate[(following::nobreak)]') as $i => $nd) {
                     if ($nd->tagName == 'nobreak' && $node->getAttribute('end')) {
                         break;
                     }
                     $_h = $nd->getAttribute('height');
                     if ($i > 0 && !$loc_offset) {
                         $_h = 0;
                     }
                     $max_h += intval($_h);
                     $loc_offset = $nd->getAttribute('x_offset');
                 }
                 $max_h += $last_y;
                 if ($max_h > $printable) {
                     if ($footer) {
                         $pdf->SetY(-20);
                         $pdf->SetFont($font_name, '', 9);
                         $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C');
                         $pages[] = $pdf->PageNo();
                     }
                     $pdf->AddPage();
                 }
             }
             if ($no_brake && $pdf->y > $printable) {
                 if ($footer && !in_array($pdf->PageNo(), $pages)) {
                     $pdf->SetY(-20);
                     $pdf->SetFont($font_name, '', 9);
                     $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C');
                     $pages[] = $pdf->PageNo();
                 }
                 $pdf->AddPage();
             }
             if (!(int) $node->getAttribute('keep-pos')) {
                 $pdf->SetX($margin_left);
             }
             // сброс позиции по X-оси если <node keep-pos="0" или не задан
             if ((int) $node->getAttribute('offset-left')) {
                 $pdf->SetX((int) $node->getAttribute('offset-left') + $margin_left);
             }
             if ($node->tagName == 'text') {
                 // вывод строки
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'C';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0;
                 $text = self::prepareNodeText($node, $replacements);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0;
                 if ((int) $skip_empty) {
                     if (!trim($text)) {
                         continue;
                     }
                 }
                 $pdf->Cell($width, $height, trim($text), $border, 1, $align);
             } elseif ($node->tagName == 'paragraph') {
                 // выводит многострочный текстовый блок, можно указывать тип выравнивания текста (L, J, R, C)
                 if (($show_if = $node->getAttribute('show-if')) && !$replacements[$show_if]) {
                     continue;
                 }
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0;
                 $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0;
                 $text = self::prepareNodeText($node, $replacements, $keep_text_wrap);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0;
                 if ((int) $skip_empty) {
                     if (!trim($text)) {
                         continue;
                     }
                 }
                 $pdf->MultiCell($width, $height, $text, $border, $align);
                 if ($paragraph_indent) {
                     $pdf->Ln($paragraph_indent);
                 }
             } elseif ($node->tagName == 'ln') {
                 // перевод строки
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $pdf->Ln($height);
             } elseif ($node->tagName == 'cell') {
                 // рисует ячейку
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') != '' ? (int) $node->getAttribute('border') : 1;
                 $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0;
                 $text = self::prepareNodeText($node, $replacements, $keep_text_wrap);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $pdf->Cell($width, $height, $text, $border, 0, $align);
             } elseif ($node->tagName == 'locate') {
                 // перемещает указатель в определенную позицию в документе
                 $x = $node->getAttribute('x') ? $node->getAttribute('x') : 0;
                 $y = $node->getAttribute('y') ? $node->getAttribute('y') : 0;
                 $x_offset = (int) $node->getAttribute('x_offset') ? (int) $node->getAttribute('x_offset') : 0;
                 $y_offset = (int) $node->getAttribute('y_offset') ? (int) $node->getAttribute('y_offset') : 0;
                 if (strpos($x, '@') !== false) {
                     $x = $locates['x'][$x] + $x_offset;
                 }
                 if (strpos($y, '@') !== false) {
                     $y = $locates['y'][$y] + $y_offset;
                 }
                 if (!$x) {
                     $x = $pdf->GetX() + $x_offset;
                 }
                 if (!$y) {
                     $y = $pdf->GetY() + $y_offset;
                 }
                 $pdf->SetXY($x, $y);
             } elseif ($node->tagName == 'fix-locate') {
                 // перемещает указатель в определенную позицию в документе
                 if ($x = $node->getAttribute('x')) {
                     $locates['x'][$x] = $pdf->GetX();
                 }
                 if ($y = $node->getAttribute('y')) {
                     $locates['y'][$y] = $pdf->GetY();
                 }
             } elseif ($node->tagName == 'line') {
                 // рисует простую горизонтальную линию
                 $x = (int) $node->getAttribute('x') ? (int) $node->getAttribute('x') : $margin_left;
                 $y = (int) $node->getAttribute('y') ? (int) $node->getAttribute('y') : $margin_top;
                 $len = (int) $node->getAttribute('len') ? (int) $node->getAttribute('len') : $text_width;
                 if ($x) {
                     $pdf->setX($x);
                 }
                 if ($y) {
                     $pdf->setY($y);
                 }
                 $pdf->Cell($len, 0, '', 1);
             } elseif ($node->tagName == 'newpage') {
                 //новая страница и перевод указателя на нее
                 $pdf->AddPage();
             }
         }
     }
     return $pdf;
 }
	<?php 
require_once 'fpdf16/fpdf.php';
// $orientação (P|L), $unidade (cm, mm, etc), $folha (A4, Letter, etc)
$pdf = new FPDF('P', 'cm', 'A4');
// título do documento
$pdf->SetTitle('Arquivo teste - PHP Advanced II');
// autor do documento
$pdf->SetAuthor('Charles Schaefer - PHPrime');
// Adiciona a primeira página, tipo retrato
$pdf->AddPage('P');
// Indica a fonte que vai ser utilizada
$pdf->SetFont('Arial', 'B', 14);
// indica a cor do texto (r, g, b)
$pdf->SetTextColor(250, 0, 0);
// Posição do texto
$pdf->SetXY(5, 5);
// Escreve o texto
// $altura_linha, $texto
$pdf->Write(0.5, 'Gerando arquivos PDF com FPDF');
// Quebra de linha no arquivo ($altura)
$pdf->Ln(1);
$pdf->write(1, 'Texto simples, de introdução');
// $x, $y, $texto
$pdf->Text(1, 8, 'Dessa vez utilizando o método Text()');
$pdf->Output('/tmp/teste.pdf');
$imp_type_papier = $_REQUEST['imp_type_papier'];
$imp_logo = $_REQUEST['imp_logo'];
$nb_papier = $_REQUEST['nb_papier'];
$couleur_rgb_prim = func_SetRgbValueFromHex($coul_prim);
$couleur_rgb_sec = func_SetRgbValueFromHex($coul_sec);
define('FPDF_FONTPATH', './font/');
require './fpdf.php';
$lycee = "IUT";
$ville = "POITIERS";
$auteur = "Sébastien CELLES";
$auteur_mail = "*****@*****.**";
$tick = array("no" => 0, "small" => 1, "big" => 2, "verybig" => 3);
$width = array("normal" => 0.1, "bold" => 0.35, "normal-bold" => 0.25);
$pdf = new FPDF();
$pdf->Open();
$pdf->SetAuthor($auteur);
$pdf->SetTitle('Génération de papiers spéciaux');
$pdf->SetMargins(0, 0);
$pdf->SetLineWidth($width["normal"]);
$pdf->SetAutoPageBreak(1);
$pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0, 0, 0);
$date = date("d/m/Y à H:i:s");
switch ($_REQUEST['papier']) {
    // Génération papier quadrillé 5mm x 5mm
    case 1:
        for ($page = 1; $page <= $nb_papier; $page++) {
            $pdf->AddPage();
            $pdf->SetDrawColor($couleur_rgb_sec[0], $couleur_rgb_sec[1], $couleur_rgb_sec[2]);
            for ($i = 10; $i <= 280; $i += 5) {
                $pdf->Line(10, $i, 200, $i);
示例#17
0
<?php

include "../../libraries/tcpdf/font/times.php";
//fpdf
$this->load->library('fpdf');
//fpdf
$nombre = "";
$fpdf = new FPDF();
ob_end_clean();
//inicializa pagina pdf
$fpdf->Open();
$fpdf->AddPage();
$fpdf->SetAuthor("codigoweblibre.comli.co - codigoweblibre.wordpress.com", true);
$fpdf->SetCreator("codigoweblibre.comli.co - codigoweblibre.wordpress.com", true);
//Cabecera
$fpdf->SetFont('Arial', 'B', 12);
$fpdf->SetTextColor("0", "8", "8");
//rojo
//$fpdf->Image(base_url() . 'img/User.png', 10, 10, -100);
$fpdf->SetFontSize(10);
$fpdf->Image('imagenes/banner.png', 8, 10, 192, 22, 'PNG');
$fpdf->Cell(100, 30, ' ', 0, 1, 'C');
$fpdf->Image('imagenes/bandera2.png', 8, 35, 192, 1, 'PNG');
$fpdf->Cell(0, 6, 'UNIDAD EJECUTORA DE TITULACION', 0, 1, 'C');
$fpdf->Cell(0, 6, 'DEL MINISTERIO DE OBRAS PUBLICAS, SERVICIOS Y VIVIENDA', 0, 1, 'C');
$fpdf->SetFont('Arial', 'BU', 10);
$fpdf->Cell(0, 3, '', 0, 1, 'C');
$fpdf->Cell(0, 6, 'REPORTE DE PERSONAL POR FECHA DE MODIFICACION', 0, 1, 'C');
$fpdf->Ln();
$fpdf->SetFont('Arial', 'B', 10);
$fpdf->Cell(45, 7, "Nombre ", 1);
示例#18
0
    //Logo
    $this->Image('images/new.png',10,8,33);
   
}
 */
    //Page footer
    function Footer()
    {
        //Position at 1.5 cm from bottom
        $this->SetY(-15);
        //Arial italic 8
        $this->SetFont('Arial', 'I', 8);
        //Page number
        $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
        $this->Cell(0, 10, 'Powered By: Wizglobal Kenya', 0, 0, 'R');
    }
}
$pdf = new FPDF();
$pdf->open();
$pdf->AddPage('L', 'a4');
//header1
$pdf->SetAuthor('Allan & Zach: Wizglobal');
$pdf->SetTitle('CANCELLED TRANSACTIONS ');
//setting the start date for all transactions
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($datefrom == NULL || $dateto == NULL) {
    $starting = "REVERSED TRANSACTIONS POSTED ON: " . date("F j, Y, g:i a");
} else {
    $starting = "REVERSED TRANSACTIONS AS FROM " . $datefrom . " TO " . $dateto;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $this->Image('images/new.png',10,8,33);
示例#19
0
<?php

session_start();
require_once '../includes/connecti.php';
require_once '../includes/funcs.inc.php';
if (isset($_GET['report']) && $_GET['report'] == 'true') {
    $MAX_LIMIT = 8;
    require_once '../includes/fpdf.php';
    $pdf = new FPDF('L', 'cm', array(7.7, 15.9));
    $pdf->SetAuthor("*****@*****.**");
    $pdf->SetSubject("Cheque");
    $pdf->SetTitle("Cheque");
    $pdf->SetCreator("Imran Zahid");
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 12);
    $amt = explode(' ', convertCurrency($_GET['amount']) . " Only.");
    $str1 = "";
    $sep = "";
    $w = 0;
    $counter = 0;
    do {
        $temp = $str1 . $sep . $amt[$counter];
        $w = $pdf->GetStringWidth($temp);
        if ($w < $MAX_LIMIT) {
            $str1 .= $sep . $amt[$counter];
            $sep = " ";
            $counter++;
        }
        if ($counter > count($amt)) {
            break;
        }
示例#20
0
            $cancelado += $res['total'];
            break;
        case 3:
            $cancelado += $res['total'];
            break;
        case 16:
            $cancelado += $res['total'];
            break;
    }
}
$pdf = new FPDF('L', 'cm', 'Letter');
//papel personalizado
$pdf->Open();
$pdf->SetMargins(2, 2);
//seta as margens do documento
$pdf->SetAuthor('Softfox');
$pdf->SetFont('times', '', 7);
$pdf->SetDisplayMode(100, 'continuous');
//define o nivel de zoom do documento PDF
$pdf->AddPage();
$pdf->Image('../images/pipeline.jpg', '0', '0', '21', 'auto', 'JPG');
$pdf->SetFont('times', '', 14.8);
$pdf->Cell(5.4, 1.9, $prospect, 0, 1, 'C');
$pdf->Cell(5.4, 1.6, $qualificado, 0, 1, 'C');
$pdf->Cell(5.4, 1.8, $proposta, 0, 1, 'C');
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(5.4, 1.8, $negociacao, 0, 1, 'C');
$pdf->Cell(5.4, 1.7, $fechamento, 0, 1, 'C');
$pdf->Cell(5.4, 1.7, $pagamento_efetivado, 0, 1, 'C');
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(5.4, 1.9, $cancelado . ' Fichas Canceladas', 0, 1, 'C');
示例#21
0
function parse_pdf_content($content, $member_id)
{
    // parse text content from Smarty to pdf content
    global $db, $config, $t;
    $pdf_content = '';
    $margins = array(mm_to_pt(20), mm_to_pt(20), mm_to_pt(20), mm_to_pt(20));
    //left, top, right, bottom (in points) 56pt ~= 20mm
    $font_size = 14;
    //points
    $pdf = new FPDF('P', 'pt', 'A4');
    // portrait, A4
    $pdf->SetCompression(false);
    $pdf->SetMargins($margins[0], $margins[1], $margins[2]);
    //only left, top, right margins. bottom margin equals to 20mm by default.
    $pdf->SetTitle('Your Invoice');
    $pdf->SetSubject('*** Your Payment');
    $pdf->SetAuthor('aMember');
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', $font_size);
    $current_x = $pdf->GetX();
    $current_y = $pdf->GetY();
    $width = mm_to_pt(210);
    $height = mm_to_pt(270);
    $width = $width - $margins[0] - $margins[2];
    // target width
    $height = $height - $margins[1] - $margins[3];
    // target height
    $image = $config['root_dir'] . "/logo.jpg";
    // logo path to include in pdf at top-right corner
    if (is_file($image)) {
        $size = getimagesize($image);
        $x = $width - $size[0] + $margins[0];
        $y = $current_y;
        $pdf->Image($image, $x, $y, $size[0], $size[1]);
        // use original size
        $current_y += $size[1];
    }
    $current_y += $font_size;
    //pt
    $contacts = explode("\n", $config['invoice_contacts']);
    // output contact information right-aligned
    $max_length = 0;
    foreach ($contacts as $row) {
        $row = trim($row);
        $length = $pdf->GetStringWidth($row);
        if ($length > $max_length) {
            $max_length = $length;
        }
    }
    $x = $width - $max_length + $margins[0];
    $y = $current_y;
    foreach ($contacts as $row) {
        $row = trim($row);
        $attr = get_font_styles($row);
        $pdf->SetFont('Arial', $attr, $font_size);
        $pdf->Text($x, $y, strip_tags($row));
        $y += $font_size;
    }
    $current_y = $y;
    $pdf->SetFont('Arial', '', $font_size);
    //return font settings
    // customer contacts
    $u = $db->get_user($member_id);
    if (!$t) {
        $t =& new_smarty();
    }
    $t->assign('u', $u);
    $cust_contacts = $t->fetch('mail_receipt_contact.pdf.txt');
    $cust_contacts = explode("\n", $cust_contacts);
    // output contact information left-aligned
    $num_rows = count($contacts);
    $x = $margins[0];
    $y = $current_y - $font_size * $num_rows;
    // $num_rows rows up from contact information and output customer data
    foreach ($cust_contacts as $row) {
        $row = trim($row);
        $attr = get_font_styles($row);
        $pdf->SetFont('Arial', $attr, $font_size);
        $pdf->Text($x, $y, strip_tags($row));
        $y += $font_size;
    }
    $current_y = $y;
    /*
    $y = $current_y - $font_size * 4; // 4 rows up from contact information and output customer data
    
    $string = $u['name_f'] . ' ' . $u['name_l'];
    $pdf->Text ($x, $y, $string);
    $y += $font_size;
    
    $string = $u['street'];
    $pdf->Text ($x, $y, $string);
    $y += $font_size;
    
    $string = $u['zip'] . ' ' . $u['city'];
    $pdf->Text ($x, $y, $string);
    $y += $font_size;
    
    	$state = db_getStateByCode($u['country'], $u['state']);
    	$country = db_getCountryByCode($u['country']);
    $string = $state .  ' '  . $country;
    $pdf->Text ($x, $y, $string);
    $y += $font_size;
    */
    $current_y = $y + $font_size * 2;
    //2 rows down
    $pdf->SetFont('Arial', '', $font_size);
    //return font settings
    // remove new lines
    $content = str_replace("\n", "", $content);
    $content = str_replace("\r", "", $content);
    $content = str_replace("&pound;", chr(163), $content);
    // split text by <br />
    $content = explode("<br />", $content);
    $y = $current_y;
    // count maximum columns widths
    $widths = array();
    foreach ($content as $text) {
        $text = trim($text);
        if (preg_match('/\\|/i', $text, $regs)) {
            $column = 0;
            $items = explode("|", $text);
            foreach ($items as $item) {
                $length = $pdf->GetStringWidth(trim(strip_tags($item))) + 10;
                if ($widths[$column] < $length) {
                    $widths[$column] = $length;
                }
                $column++;
            }
        }
    }
    $length = 0;
    for ($i = 1; $i < count($widths); $i++) {
        $length += $widths[$i];
    }
    // width of column 0 is *
    $widths[0] = $width - $length;
    foreach ($content as $hr_content) {
        $hr_content = trim($hr_content);
        // split text by <hr>
        $hr_content = explode("<hr>", $hr_content);
        $hr_count = count($hr_content) - 1;
        //<br /> add new line
        if ($hr_count < 1 && strip_tags($hr_content[0]) == '') {
            $y += $font_size;
        }
        foreach ($hr_content as $text) {
            $line_feeds = 1;
            // how much rows feed
            if (strip_tags($text) != '') {
                // if there is a text
                if (!preg_match('/\\|/i', $text, $regs)) {
                    // simple text
                    $y += $font_size * $line_feeds;
                    $attr = get_font_styles($text);
                    $text = trim(strip_tags($text));
                    $pdf->SetFont('Arial', $attr, $font_size);
                    $pdf->Text($x, $y, $text);
                    // simple textout. no line feeds allowed.
                    /*
                    $length = $pdf->GetStringWidth ($text);
                    while ($length > $width)
                        $line_feeds++;
                    */
                } else {
                    //table content (splitted by "|")
                    $border = 0;
                    $fill = 0;
                    $pdf->SetFillColor(192, 192, 192);
                    // Silver
                    if (preg_match('/<fill>(.*)<\\/fill>/i', $text, $regs)) {
                        $text = $regs[1];
                        $fill = 1;
                    }
                    $text = strip_tags($text);
                    $items = explode("|", $text);
                    $column = 0;
                    $x = $margins[0];
                    foreach ($items as $item) {
                        $attr = get_font_styles($item);
                        $item = trim(strip_tags($item));
                        $pdf->SetFont('Arial', $attr, $font_size);
                        if ($column > 0) {
                            $align = 'R';
                        } else {
                            $align = 'L';
                        }
                        $pdf->SetXY($x, $y);
                        $pdf->MultiCell($widths[$column], $font_size, $item, $border, $align, $fill);
                        // multi rows output
                        for ($i = 1; $i < $line_feeds; $i++) {
                            $_y = $y + $i * $font_size;
                            $pdf->SetXY($x, $_y);
                            $pdf->MultiCell($widths[$column], $font_size, '', $border, $align, $fill);
                            // empty rows
                        }
                        if ($column == 0) {
                            // count line feeds only for 0 column
                            $length = $pdf->GetStringWidth($item);
                            while ($length > $widths[$column]) {
                                $line_feeds++;
                                $length -= $widths[$column];
                            }
                        }
                        $x += $widths[$column];
                        $column++;
                    }
                    $y += $font_size * $line_feeds;
                    $pdf->SetXY($margins[0], $y);
                }
            }
            // (strip_tags($text) != '')
            if ($hr_count > 0) {
                // check count of <hr> (do not draw last <hr>)
                $y += 2;
                $pdf->Line($margins[0], $y, $margins[0] + $width, $y);
                $y += 2;
                $hr_count--;
            }
            $x = $margins[0];
        }
        //foreach hr_content
    }
    //foreach content
    $current_y = $y;
    $pdf_content = $pdf->Output('', 'S');
    //get pdf content
    return $pdf_content;
}
示例#22
0
    public static function createEmptyRenderError($filename,$filepath){


        require_once(Yii::app()->basePath.'/extensions/Fpdf/fpdf.php');

        $pdf = new FPDF('P','mm','Letter');

        $pdf->SetAuthor('ASA AP');
        $pdf->SetTitle('Render error');
        //set font for the entire document
        $pdf->SetFont('Helvetica','B',20);
        $pdf->SetTextColor(255,0,0);
        //set up a page
        $pdf->AddPage('P');
        $pdf->SetDisplayMode(90,'default');

        //Set x and y position for the main text, reduce font size and write content
        $pdf->SetXY (30,55);
        $pdf->SetFontSize(15);
        $pdf->Write(5,'Existing document '.$filename.' can\'t be rendered');
        //Output the document
        $pdf->Output($filepath,'F');
        $pdf->Close();

        return $filepath;
    }
	// compteur pour le nombre d'élève à affiché
	$nb_eleve_aff = 1;

	// si la variable $gepiSchoolName est vide alors on cherche les informations dans la base
	if ( empty($gepiSchoolName) )
	{

		$gepiSchoolName=getSettingValue('gepiSchoolName');

	}

	// 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);


/* **************************** */
示例#24
0
 public function otr_pdf_writer($file, $info)
 {
     // Generate Filename based on Person's & Timestamp
     $path = getcwd();
     if (!is_dir($path . '/img/')) {
         if (mkdir($path . '/img')) {
             if (!mkdir($path . '/img/otr_pdfs')) {
                 return false;
             }
         } else {
             return false;
         }
     } elseif (!is_dir($path . '/img/otr_pdfs/')) {
         if (!mkdir($path . '/img/otr_pdfs')) {
             return false;
         }
     }
     $url_file_path = '/img/otr_pdfs/' . $file;
     $filename = $path . $url_file_path;
     $info['student_full_name'] = $info['first_name'] . ' ' . $info['middle_name'] . ' ' . $info['last_name'];
     $pdf = new FPDF('P', 'mm', array(218, 290));
     $pdf->SetAuthor($info['student_full_name']);
     $pdf->SetTitle('OTR');
     $pdf->SetFont('Helvetica', 'B', 20);
     $pdf->SetTextColor(50, 60, 100);
     $pdf->AddPage('P');
     $pdf->SetFontSize(10);
     // Background image
     $pdf->Image('img/otr_multi_form2.png', 0, 0);
     $start_x = 18;
     $start_y = 46;
     for ($i = 0; $i < 3; $i++) {
         // Fill out first form
         // Name
         $pdf->SetFont('Times', 'B', 14);
         $start_address_Y = $start_y - 27;
         foreach ($info['otr_address'] as $otr_address) {
             $pdf->SetXY($start_x + 109, $start_address_Y);
             $pdf->Write(5, $otr_address);
             $start_address_Y += 5;
         }
         $pdf->SetFont('Helvetica', 'B', 10);
         $pdf->SetXY($start_x, $start_y);
         $pdf->Write(5, $info['student_full_name']);
         // Address
         $pdf->SetXY($start_x + 2, $start_y + 6.5);
         $pdf->Write(5, $info['address1']);
         // City, State
         $pdf->SetXY($start_x + 1, $start_y + 13);
         $pdf->Write(5, $info['city'] . ', ' . $info['state']);
         // Zip Code
         $pdf->SetXY($start_x + 58, $start_y + 13);
         $pdf->Write(5, $info['zip_code']);
         // Phone Number & Email
         $pdf->SetXY($start_x + 15, $start_y + 26);
         $pdf->Write(5, $info['home_phone']);
         $pdf->SetFontSize(8);
         $pdf->SetXY($start_x + 52, $start_y + 26);
         $pdf->Write(5, $info['email']);
         $pdf->SetFontSize(10);
         // Birth Date
         $birth_date = explode('-', $info['dob']);
         $pdf->SetXY($start_x + 115, $start_y + 26);
         $pdf->Write(5, $birth_date[0]);
         $pdf->SetXY($start_x + 122.5, $start_y + 26);
         $pdf->Write(5, $birth_date[1]);
         $pdf->SetXY($start_x + 130, $start_y + 26);
         $pdf->Write(5, $birth_date[2]);
         // Today's Date
         $pdf->SetXY($start_x + 102, $start_y + 32.5);
         $pdf->Write(5, date('m'));
         $pdf->SetXY($start_x + 109.5, $start_y + 32.5);
         $pdf->Write(5, date('d'));
         $pdf->SetXY($start_x + 117, $start_y + 32.5);
         $pdf->Write(5, date('Y'));
         // Move to the next form:
         $start_y = $start_y + 93;
     }
     $pdf->Output($filename);
     if (file_exists($filename)) {
         return $url_file_path;
     } else {
         return false;
     }
 }
示例#25
0
 public function get_receipt($transaction_id)
 {
     $this->load->library('fpdf');
     $transaction_details = $this->get_transaction($transaction_id);
     $this->load->model('User_model');
     $this->User_model->initialize($transaction_details['user_id']);
     $user_details = $this->User_model->get('*');
     //lookup profile
     $profile_details = $this->get_profile($transaction_details['profile_id'], 'billingperiod, amount, taxamt');
     //lookup subscription
     $subscription_details = $this->get_subscription_by_transaction($transaction_id);
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->AddPage();
     $pdf->SetAuthor('ESCTT Inc.');
     $pdf->SetTitle('Invoice');
     $pdf->Image('http://v1.riskmp.com/assets/images/logo.png', 10, 10, 35, 19, '', 'http://v1.riskmp.com/');
     $pdf->SetXY(50, 10);
     $pdf->SetFont('Arial', 'B', 40);
     $pdf->Cell(100, 20, 'Receipt');
     $address_x = $pdf->GetX();
     $pdf->set_field_title_font($pdf);
     $pdf->Write(14, 'ESCTT Inc.');
     $pdf->Ln(5);
     $pdf->SetX($address_x);
     $pdf->Write(14, '131 Bloor Street West');
     $pdf->Ln(5);
     $pdf->SetX($address_x);
     $pdf->Write(14, 'Suite 200/318');
     $pdf->Ln(5);
     $pdf->SetX($address_x);
     $pdf->Write(14, 'Toronto, ON M5S 1R8');
     $pdf->Ln(5);
     $pdf->SetX($address_x);
     $pdf->Write(14, 'Business # ' . BUSINESS_NUMBER);
     $pdf->SetXY(10, 40);
     $pdf->set_field_title_font($pdf);
     $pdf->Write(10, 'Client: ');
     $pdf->set_field_value_font($pdf);
     $pdf->Write(10, $user_details['first_name'] . " " . $user_details['last_name']);
     $pdf->set_field_title_font($pdf);
     $pdf->SetX(140);
     $pdf->Write(10, 'Generated on: ');
     $pdf->set_field_value_font($pdf);
     $pdf->Write(10, date("Y-m-d"));
     $pdf->Ln(16);
     $pdf->SetFont('Arial', 'B', 18);
     $pdf->Write(6, 'Transaction Details');
     $pdf->Ln(6);
     $pdf->set_field_title_font($pdf);
     $pdf->Write(14, 'Transaction ID: ');
     $pdf->set_field_value_font($pdf);
     $pdf->Write(14, $transaction_id);
     $pdf->Ln(7);
     $pdf->set_field_title_font($pdf);
     $pdf->Write(14, 'Order Time: ');
     $pdf->set_field_value_font($pdf);
     $pdf->Write(14, $transaction_details['order_time']);
     $pdf->Ln(7);
     $pdf->set_field_title_font($pdf);
     $pdf->Write(14, 'Payment Method: ');
     $pdf->set_field_value_font($pdf);
     $pdf->Write(14, 'Credit Card');
     $pdf->Ln(16);
     $pdf->SetFont('Arial', 'B', 18);
     $pdf->Write(6, 'Purchase Details');
     $pdf->Ln(4);
     //set table header and body fonts
     $thfont = array('family' => 'Arial', 'style' => 'B', 'size' => 11);
     $tbfont = array('family' => 'Arial', 'style' => '', 'size' => 11);
     $pdf->Ln(4);
     $twidth = array(150, 50);
     //column widths
     $theader = array('Item', 'Amount');
     //column titles
     $tdata = array(array('RiskMP Membership @ 1 ' . $profile_details['billingperiod'], '$' . $profile_details['amount']), array('Tax', '$' . $profile_details['taxamt']), array('Grand Total', '$' . number_format(floatval($profile_details['amount']) + floatval($profile_details['taxamt']), 2, '.', '')));
     $pdf->create_table($theader, $tdata, $twidth, 'L', 'L', $thfont, $tbfont);
     //add table to pdf document
     $pdf->set_field_title_font($pdf);
     $pdf->Write(14, 'Subscription Start Date: ');
     $pdf->set_field_value_font($pdf);
     $pdf->Write(14, $subscription_details['date_of_redemption']);
     $pdf->Ln(7);
     $pdf->set_field_title_font($pdf);
     $pdf->Write(14, 'Subscription Expiry Date: ');
     $pdf->set_field_value_font($pdf);
     $pdf->Write(14, $subscription_details['expiry_date']);
     return $pdf;
 }
 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;
     }
 }
示例#27
0
if (isset($_COOKIE['lname'])) {
    $lname = $_COOKIE['lname'];
} else {
    echo "<script type='text/javascript'>alert('lname NAME NOT PRESENT IN DATABASE');</script>";
}
if (isset($_COOKIE['phone'])) {
    $phone = $_COOKIE['phone'];
} else {
    echo "<script type='text/javascript'>alert('phone NAME NOT PRESENT IN DATABASE');</script>";
}
if (isset($_COOKIE['address'])) {
    $address = $_COOKIE['address'];
} else {
    echo "<script type='text/javascript'>alert('address NAME NOT PRESENT IN DATABASE');</script>";
}
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetAuthor('Lana Kovacevic');
$pdf->SetTitle('FPDF tutorial');
$pdf->SetFont('Arial', "B", 20);
$pdf->Cell(0, 10, "Thanks {$name} for shopping with us", 0, 1, "C");
$pdf->Cell(0, 10, "Fullname : {$name} {$lname} ", 0, 1, "l");
$pdf->Cell(0, 10, "EmailID  : {$email} ", 0, 1, "l");
$pdf->Cell(0, 10, "Mobile No  : {$phone} ", 0, 1, "l");
$pdf->Cell(0, 10, "Address  : {$address} ", 0, 1, "l");
//		$pdf->Cell(100,10,"sada",1,0,"R");
$pdf->output();
/*			require("fpdf/fpdf.php");

?>
*/
示例#28
0
 public function otr_pdf_writer($file, $info)
 {
     $path = getcwd();
     if (!is_dir($path . '/img/')) {
         if (mkdir($path . '/img')) {
             if (!mkdir($path . '/img/otr_pdfs')) {
                 return false;
             }
         } else {
             return false;
         }
     } elseif (!is_dir($path . '/img/otr_pdfs/')) {
         if (!mkdir($path . '/img/otr_pdfs')) {
             return false;
         }
     }
     $url_file_path = '/img/otr_pdfs/' . $file;
     $filename = $path . $url_file_path;
     $info['student_full_name'] = $info['FirstName'] . ' ' . $info['MiddleName'] . ' ' . $info['LastName'];
     $pdf = new FPDF('P', 'mm', array(218, 290));
     $pdf->SetAuthor($info['student_full_name']);
     $pdf->SetTitle('OTR');
     $pdf->SetFont('Helvetica', 'B', 20);
     $pdf->SetTextColor(50, 60, 100);
     $pdf->AddPage('P');
     //$pdf->SetDisplayMode('real','default');
     $pdf->SetFontSize(10);
     // Background image
     $pdf->Image('../resources/otr/otr_multi_form2.png', 0, 0);
     $start_x = 18;
     $start_y = 46;
     for ($i = 0; $i < 3; $i++) {
         // Fill out first form
         // Name
         $pdf->SetFont('Times', 'B', 14);
         $start_address_Y = $start_y - 27;
         foreach ($info['otr_address'] as $otr_address) {
             $pdf->SetXY($start_x + 109, $start_address_Y);
             $pdf->Write(5, $otr_address);
             $start_address_Y += 5;
         }
         $pdf->SetFont('Helvetica', 'B', 10);
         $pdf->SetXY($start_x, $start_y);
         $pdf->Write(5, $info['student_full_name']);
         // Address
         $pdf->SetXY($start_x + 2, $start_y + 6.5);
         $pdf->Write(5, $info['addr_line1_CA']);
         // Years of Attendance (I don't believe we are gathering this information)
         //$pdf->SetXY($start_x+90,$start_y+6.5);
         //$pdf->Write(5,$info['name']);
         //$pdf->SetXY($start_x+115,$start_y+6.5);
         //$pdf->Write(5,$info['name']);
         // City, State
         $pdf->SetXY($start_x + 1, $start_y + 13);
         $pdf->Write(5, $info['city_CA'] . ', ' . $info['st_ca']);
         // Zip Code
         $pdf->SetXY($start_x + 58, $start_y + 13);
         $pdf->Write(5, $info['zip_CA']);
         // Soc. Security Number
         //            $pdf->SetXY($start_x+26,$start_y+19.5);
         //            $pdf->Write(5,$info['SF_NO']);
         // Phone Number & Email
         $pdf->SetXY($start_x + 15, $start_y + 26);
         if ($info['pref_contact'] == 'cell_phone') {
             $pdf->Write(5, $info['ndcellphone']);
         } else {
             $pdf->Write(5, $info['phone']);
         }
         $pdf->SetFontSize(8);
         $pdf->SetXY($start_x + 52, $start_y + 26);
         $pdf->Write(5, $info['line1']);
         $pdf->SetFontSize(10);
         // Birth Date
         $birth_date = explode('/', $info['birth_date']);
         $pdf->SetXY($start_x + 115, $start_y + 26);
         $pdf->Write(5, $birth_date[0]);
         $pdf->SetXY($start_x + 122.5, $start_y + 26);
         $pdf->Write(5, $birth_date[1]);
         $pdf->SetXY($start_x + 130, $start_y + 26);
         $pdf->Write(5, $birth_date[2]);
         // Today's Date
         $pdf->SetXY($start_x + 102, $start_y + 32.5);
         $pdf->Write(5, date('m'));
         $pdf->SetXY($start_x + 109.5, $start_y + 32.5);
         $pdf->Write(5, date('d'));
         $pdf->SetXY($start_x + 117, $start_y + 32.5);
         $pdf->Write(5, date('Y'));
         // Move to the next form:
         $start_y = $start_y + 93;
     }
     $pdf->Output($filename);
     if (file_exists($filename)) {
         //$full_url = 'http://'.$_SERVER['HTTP_HOST'].$url_file_path;
         return $url_file_path;
     } else {
         return false;
     }
 }
}
if ($_POST["month"] != '') {
    $_SESSION['month'] = $_POST["month"];
}
if ($_POST["year"] != '') {
    $_SESSION['year'] = $_POST["year"];
}
if ($_POST["search_study_type"] == 'Денна') {
    $study_type = "stc";
}
if ($_POST["search_study_type"] == 'Заочна') {
    $study_type = "zao";
}
$pdf = new FPDF();
//set document properties
$pdf->SetAuthor('Alexandr Slovinskiy');
$pdf->SetTitle('Order Annex');
//set font for the entire document
$pdf->AddFont('Times', '', 'times.php');
$pdf->SetFont('Times', '');
$pdf->SetTextColor(0, 0, 0);
//set up a page
$pdf->AddPage('L');
$pdf->SetDisplayMode(real, 'default');
//display the title with a border around it
//Set x and y position for the main text, reduce font size and write content
$pdf->Image('img/form_1-12-2.jpg', 10, 15, 280);
$pdf->SetFontSize(9);
$pdf->SetXY(261, 29.5);
$pdf->Write(5, $_POST["order_number"]);
$pdf->SetXY(197.5, 37);
示例#30
0
// Margem Superior (mm)
$leti = "72";
// Largura da Etiqueta (mm)
$aeti = "27";
// Altura da Etiqueta (mm)
$ehet = "3,2";
// Espaço horizontal entre as Etiquetas (mm)
$pdf = new FPDF('P', 'mm', 'Letter');
// Cria um arquivo novo tipo carta, na
vertical . $pdf->Open();
// inicia documento
$pdf->AddPage();
// adiciona a primeira pagina
$pdf->SetMargins('5', '12,7');
// Define as margens do documento
$pdf->SetAuthor("Jonas Ferreira");
// Define o autor
$pdf->SetFont('helvetica', '', 7);
// Define a fonte
$pdf->SetDisplayMode($zoom, $layout = 'continuous');
$coluna = 0;
$linha = 0;
//MONTA A ARRAY PARA ETIQUETAS
while ($dados = mysql_fetch_array($busca)) {
    $nome = $dados["nomefantasia"];
    $ende = $dados["endereco"];
    $bairro = $dados["bairro"];
    $estado = $dados["estado"];
    $cida = $dados["cidade"];
    $local = $cida . " - " . $estado;
    $cep = "CEP: " . $dados["cep"];