示例#1
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);
	}
function genpdf($typefacture, $datefacture, $nofacture, $montant, $civilite, $client, $contact, $chrono, $today)
{
    $pdf = new FPDF("P", "mm", "A4");
    $pdf->AddPage();
    $pdf->SetMargins(20, 20);
    $pdf->AddFont("Arialb", "", "arialb.php");
    //$pdf->AddFont("Courier","","arialb.php");
    /////////////////////////////////////en tete////////////////////////////////////////
    //logo
    $pdf->SetXY(18, 24);
    $X = $pdf->GetX();
    $Y = $pdf->GetY();
    $pdf->Image("img/logo.jpg", $X, $Y, 23, 19, "jpg");
    //Commune de Faa"a
    $pdf->SetXY(42, 22);
    $X = $pdf->GetX();
    $Y = $pdf->GetY();
    $pdf->SetFont("Arialb", "", 13);
    $pdf->Cell(55, 10, utf8_decode("COMMUNE DE FAA'A"));
    $pdf->SetXY($X + 1, $Y + 8);
    $pdf->SetFont("Arial", "", 12);
    $pdf->Cell(55, 5, utf8_decode("N° {$chrono}/DAF/FTR-Régie-hp"), 1, 1, "C");
    //$X=$pdf->GetX();
    $Y = $pdf->GetY();
    $pdf->SetXY($X, $Y);
    $pdf->SetFont("Arial", "", 9);
    $pdf->Cell(55, 5, utf8_decode("Affaire suivie par : Hinatini Parker"), 0, 1);
    $Y = $pdf->GetY();
    $pdf->SetXY($X, $Y);
    $pdf->SetFont("Arial", "", 9);
    $pdf->Cell(55, 3, utf8_decode("Téléphone : 800 960 poste 421"), 0, 0);
    ///////////////////////////////////fin en tete/////////////////////////////////////
    ///////////////////////////////////colonne droite/////////////////////////////////
    //Date
    $pdf->SetXY($X + 100, $Y);
    $pdf->SetFont("Arial", "", 10);
    $pdf->Cell(55, 3, "Faa'a le " . $today, 0);
    ///////////////////////////////////fin colonne droite////////////////////////////
    /////////////////////////////////info exp/dest //////////////////////////////////////
    //Le Maire
    $pdf->SetY(60);
    $pdf->SetFont("times", "", 18);
    $pdf->Cell(0, 10, "Le Maire", 0, 1, "C");
    //Destinataire
    $pdf->SetY(70);
    $pdf->SetFont("Arial", "", 10);
    $pdf->Multicell(0, 5, utf8_decode("à\n{$client}\n{$contact}"), 0, "C");
    $currentY = $pdf->GetY();
    $pdf->SetY($currentY + 10);
    $pdf->SetFont("Arialb", "U", 10);
    $pdf->Cell(20, 5, utf8_decode("Objet :"), 0, 0, "L");
    $pdf->SetFont("Arialb", "", 10);
    $pdf->Cell(0, 5, utf8_decode("Relance des factures impayées"), 0, 1, "L");
    $pdf->SetFont("Arial", "U", 10);
    $pdf->Cell(20, 5, utf8_decode("N/Réf :"), 0, 0, "L");
    $pdf->SetFont("Arial", "", 10);
    $pdf->Cell(0, 5, utf8_decode("Facture {$typefacture} N° {$nofacture} du {$datefacture}"), 0, 1, "L");
    $Y = $pdf->GetY();
    $pdf->SetY($Y + 20);
    $text = "{$civilite},\n\nJe vous informe que, sauf erreur de ma part, vous présentez un impayé " . "envers la Commune de FAA'A d'un montant de {$montant} FCP au titre de la (des) {$typefacture}.\n\n" . "Aussi, je vous demande de bien vouloir vous rapprocher de la Régie municipale pour vous acquitter de la somme due.\n\n" . "A défaut de réponse de votre part dans un délai de 45 jours à compter de la date du présent courrier," . "votre dossier sera transmis en contentieux à la Trésorerie des Iles du Vent, des Australes et des Archipels pour commandement de payer.\n\n" . "La Régie reste à votre disposition au 800.960 poste 421 pour toute entente préalable avant poursuite.\n\n" . "Je vous prie d'agréer, {$civilite}, l'expression de mes salutations distinguées";
    $pdf->Multicell(0, 5, utf8_decode($text), 0, "L");
    $pdf->Image("img/marianne.jpg", 150, 220, 31, 31, "jpg");
    ////////////////////////////////information////////////////////////////////////
    $pdf->Line(20, 273, 190, 273);
    $pdf->SetXY(20, 273);
    $pdf->SetFont("Arial", "", 7);
    $pdf->Cell(0, 3, utf8_decode("PK 4 côté mer - BP 60 002 - 98702 Faa’a Centre - Tahiti / Tél. : (689) 800 960 - Télécopie : (689) 834 890 - E-mail : mairiefaaa@mail.pf\n"), 0, 0, "C");
    ////////////////////////////////fin information////////////////////////////////////
    $pdf->Output();
}
 private function CreatePDFRendering($name, $company, $file)
 {
     $pdf = new FPDF('L', 'pt', array(162, 288));
     //2.25"x4"
     $pdf->AddPage();
     $pdf->SetFont('Arial', 'B', 22);
     //name font style
     $pdf->Cell(0, 22, $name, 0, 1, 'C');
     //name
     $pdf->Cell(0, 10, '', 0, 1, 'C');
     //blank line
     $pdf->SetFont('Arial', 'I', 16);
     //company font style
     $pdf->Cell(0, 16, $company, 0, 1, 'C');
     //company name
     $pdf->Cell(0, 28, '', 0, 1, 'C');
     //blank line
     $pdf->Image('images/logo.png', $pdf->GetX() + 165, $pdf->GetY(), 65);
     if ($file == true) {
         //set file name to hash of object
         $fullpath = $this->savedirectory . md5(spl_object_hash($pdf)) . '.pdf';
         $pdf->Output($fullpath, 'F');
         $pdf->Close();
         $cmd = 'lpr ' . $fullpath;
         $cmdout = shell_exec($cmd);
         return $fullpath;
     } else {
         return $pdf->Output();
     }
 }
示例#4
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;
}
    $pdf->Cell(35, 4, $arrData[name], $border);
    $pdf->Ln();
    $pdf->Cell(16, 4, "From", $border);
    $pdf->Cell(35, 4, $from, $border);
    $pdf->Ln();
    $pdf->Cell(16, 4, "Subject", $border);
    $pdf->Cell(35, 4, $arrData[subject], $border);
    $pdf->Ln();
    $pdf->Cell(16, 4, "College", $border);
    $pdf->Cell(35, 4, $arrData[college], $border);
    $pdf->Ln();
    $pdf->Ln();
    if ($arrData[picture] != "" && file_exists("residentsnh/" . $arrData[picture])) {
        $path_parts = pathinfo($arrData[picture]);
        if ($path_parts[extension] != 'bmp') {
            $pdf->Image("residentsnh/" . $arrData[picture], $pdf->GetX() + 100, $pdf->GetY() - 25, 18);
        } else {
            echo "Error, " . $arrData[name] . " " . $arrData[surname] . " has it's picture in BMP format!<br>";
        }
    } else {
        $pdf->Image("imgs/no_picture.png", $pdf->GetX() + 100, $pdf->GetY() - 25, 18);
    }
    $pdf->Line(46, $pdf->GetY(), 163, $pdf->GetY());
    $pdf->Ln();
    $pdf->Ln();
    if ($i == 8) {
        $pdf->AddPage();
        $i = 0;
    }
}
$pdf->Output();
示例#6
0
 $pdf->AddPage();
 $pdf->setleftmargin(10);
 $pdf->setX(20);
 $pdf->setY(10);
 $pdf->SetFillColor(0, 0, 0);
 $pdf->Cell(190, 140, '', 1, 0, "C");
 $pdf->setX(20);
 $pdf->setY(15);
 $pdf->SetFillColor(0, 0, 0);
 $image1 = 'logo.png';
 // Add some text
 $pdf->SetFont('Arial', '', 20);
 // width, height, text, no border, next line - below & left margin, alignement
 // shree rang in centre
 $pdf->Cell(175, 10, '           Explora Academy of Design', 0, 0, "C");
 $pdf->Cell(15, 10, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 10), 0, 1, 'R', false);
 $pdf->SetFillColor(0, 0, 0);
 $pdf->Rect(20, 26, 175, 1, 'F');
 $pdf->Cell(10, 8, '', 0, 1, "C");
 //set font and height
 $pdf->SetFont('Arial', '', 12);
 $pdf->SetTextColor(0, 0, 0);
 //space before form no.
 $pdf->Cell(20, 10, '', 0, 0, "C");
 $pdf->Cell(20, 7, 'RECEIPT NUMBER:', 0, 0, "C");
 //space between rect and form no tag
 $pdf->Cell(15, 10, '', 0, 0, "C");
 // create box for form
 $pdf->Cell(30, 7, $form, 1, 0, "C");
 //space after box
 $pdf->Cell(30, 10, '', 0, 0, "C");
$pdf->Cell(100, 0, utf8_decode('Número de informes: ' . $numeroInformes));
//EL GRUPO CONOCE LAS NORMAS
$datoConoceNormas = mysql_query("SELECT * FROM evaluaciongeneral WHERE grupo='{$grupo}' AND conocenormas='No'", $link);
$noConoceNormas = mysql_num_rows($datoConoceNormas);
$conoceNormas = $numeroInformes - $noConoceNormas;
$pdf->SetFont('Arial', 'B', 12);
$pdf->Ln(10);
$pdf->Cell(0, 0, utf8_decode('El grupo conoce las normas: '));
$pdf->Ln(10);
$pdf->SetFont('Arial', '', 12);
$textoConoceNormas = "Sí:" . round($conoceNormas / $numeroInformes * 100, 2) . "% (" . $conoceNormas . " respuestas)";
$textoNoConoceNormas = "No: " . round($noConoceNormas / $numeroInformes * 100, 2) . "% (" . $noConoceNormas . " respuestas)";
$pdf->Cell(80, 0, utf8_decode($textoConoceNormas));
$pdf->SetFillColor(0, 255, 0);
$pdf->SetDrawColor(0, 0, 0);
$pdf->Rect($pdf->GetX(), $pdf->GetY() - 2, $conoceNormas / $numeroInformes * 100, 3, FD);
$pdf->Ln(5);
$pdf->Cell(80, 0, utf8_decode($textoNoConoceNormas));
$pdf->SetFillColor(255, 0, 0);
$pdf->SetDrawColor(0, 0, 0);
$pdf->Rect($pdf->GetX(), $pdf->GetY() - 2, $noConoceNormas / $numeroInformes * 100, 3, FD);
$pdf->Ln(5);
//$pdf->Multicell(160,5,  utf8_decode($textoConoceNormas),1,'L',0);
$pdf->Ln(5);
//EL GRUPO CUMPLE LAS NORMAS
$datoCumpleNormas = mysql_query("SELECT * FROM evaluaciongeneral WHERE grupo='{$grupo}' AND respetanormas='No'", $link);
$noCumpleNormas = mysql_num_rows($datoCumpleNormas);
$cumpleNormas = $numeroInformes - $noCumpleNormas;
/*
$textoCumpleNormas="El grupo cumple las normas: "."\n Sí:".(($cumpleNormas/$numeroInformes)*100)."% (".$cumpleNormas." respuestas)"."\n"."No: ".(($noCumpleNormas/$numeroInformes)*100)."% (".$noCumpleNormas." respuestas)";
//$pdf->SETXY(10,45);
function report_head($report_id)
{
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM `squid_reports` WHERE ID='{$report_id}'"));
    build_progress($report_id, "Building Report...", 15);
    $pdf = new FPDF();
    $pdf->SetFont('times', '', 12);
    $pdf->SetTextColor(50, 60, 100);
    $linetime = report_by_category_pdf_range_dayz($report_id) . " - ( " . report_by_category_pdf_sumsize($report_id) . " )";
    //set up a page
    $pdf->AddPage('P');
    $pdf->SetTitle($ligne["report_name"]);
    $pdf->SetDisplayMode(real, 'default');
    $pdf->SetXY(5, 10);
    $pdf->SetFontSize(32);
    $pdf->Write(5, $ligne["report_name"]);
    $pdf->Ln();
    $pdf->Ln();
    $pdf->SetFontSize(18);
    $x1 = $pdf->GetX();
    $y1 = $pdf->GetY();
    $pdf->Line(0, $y1, 210, $y1);
    $pdf->SetFont('times', 'I', 12);
    $pdf->Write(15, $ligne["description"] . " {$linetime}");
    $pdf->SetFont('times', 'I', 12);
    $pdf->Write(15, " " . @implode(" and ", $GLOBALS["EXPLAIN_QUERY"]));
    $pdf->Ln();
    $pdf->SetFontSize(16);
    $pdf->SetFont('times', '', 12);
    return $pdf;
}
示例#9
0
 //display date
 $pdf->SetFont('Arial', 'B', 12);
 $pdf->Cell(20, 5, date("Y/m/d"), 0, 1, "C");
 //add new row
 $pdf->Cell(210, 5, '', 0, 1, "C");
 //Explora academy title
 $pdf->SetFont('Helvetica', '', 25);
 $pdf->Cell(200, 15, 'Explora Academy of Design', 0, 1, "C");
 //add new row
 $pdf->Cell(210, 5, '', 0, 1, "C");
 $pdf->SetFont('Arial', '', 12);
 $pdf->SetTextColor(0, 0, 0);
 //nata and all 3 courses
 $pdf->Cell(80, 5, '', 0, 0, "C");
 if (strtoupper($course) == "NATA") {
     $pdf->Cell(10, 5, $pdf->Image($image12, $pdf->GetX(), $pdf->GetY(), 10, 5), 1, 0, 'L', false);
     $pdf->Cell(15, 5, 'NATA', 0, 1, "C");
 } else {
     $pdf->Cell(10, 5, '', 1, 0, "C");
     $pdf->Cell(15, 5, 'NATA', 0, 1, "C");
 }
 $pdf->Cell(1, 1, '', 0, 1, "C");
 $pdf->Cell(210, 4, '', 0, 1, "C");
 $pdf->SetFont('Arial', '', 12);
 $pdf->SetTextColor(0, 0, 0);
 $pdf->Cell(80, 0, '', 0, 0, "C");
 if (strtoupper($course) == "INTERIOR DESIGN") {
     $pdf->Cell(10, 5, $pdf->Image($image12, $pdf->GetX(), $pdf->GetY(), 10, 5), 1, 0, 'L', false);
     $pdf->Cell(41, 5, 'INTERIOR DESIGN', 0, 1, "C");
 } else {
     $pdf->Cell(10, 5, '', 1, 0, "C");
$pdf->SetTextColor(107, 142, 35);
$pdf->Cell(0, 6, $parts_broken, 0, 4);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(0, 6, "Comment: ", 0, 4);
$pdf->SetTextColor(107, 142, 35);
$pdf->Cell(0, 6, $comment, 0, 4);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(0, 6, "Entry Added By: ", 0, 4);
$pdf->SetTextColor(107, 142, 35);
$pdf->Cell(0, 6, $user, 0, 4);
$pdf->SetTextColor(0, 0, 0);
if (file_exists($logo)) {
    $pdf->Image($logo, 180, 18, 20);
}
$pdf->Ln(4);
$pdf->Line($pdf->GetX() + 10, $pdf->GetY() + 2, $pdf->GetX() + 190, $pdf->GetY() + 2);
$pdf->Ln(4);
$pdf->Cell(0, 6, "Photo Gallary: ", 0, 4);
$pdf->SetTextColor(107, 142, 35);
$pdf->Ln(4);
$pdf->Cell(0, 6, "               Robot Photo                                                                  Driver Photo", 0, 4);
$pdf->SetTextColor(0, 0, 0);
if (file_exists($picture)) {
    $pdf->Image($picture, 20, $pdf->GetY() + 10, 80);
} else {
    $pdf->Image("../../team_photo/unavailable.jpg", 20, $pdf->GetY() + 10, 80);
}
if (file_exists($driver_picture)) {
    $pdf->Image($driver_picture, 120, $pdf->GetY() + 10, 80);
} else {
    $pdf->Image("../../team_photo/unavailable.jpg", 120, $pdf->GetY() + 10, 80);
	{

		$pdf->Cell(90,5, ($gepiSchoolAdress2),0,2,'');

	}

	$gepiSchoolZipCode = getSettingValue('gepiSchoolZipCode');
	$gepiSchoolCity = getSettingValue('gepiSchoolCity');
	$pdf->Cell(90,5, ($gepiSchoolZipCode." ".$gepiSchoolCity),0,2,'');
	$gepiSchoolTel = getSettingValue('gepiSchoolTel');
	$gepiSchoolFax = getSettingValue('gepiSchoolFax');

	$passealaligne = '0';
	// entête téléphone
			// emplacement du cadre télécome
			$x_telecom = $pdf->GetX();
			$y_telecom = $pdf->GetY();

	if( $entente_tel==='1' )
	{

		$grandeur = '';
		$text_tel = '';

		if ( $tel_image != '' )
		{

			$a = $pdf->GetX();
			$b = $pdf->GetY();
			$ima = '../../images/imabulle/'.$tel_image.'.jpg';
			$valeurima=redimensionne_image($ima, 15, 15);
示例#12
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;
 }
示例#13
0
$pdf->Cell(190, 5, '', 0, 2, 'C');
$pdf->SetFont('Arial', 'BU', 16);
$pdf->Cell(190, 5, 'BUSINESS APPLICATION', 0, 1, 'C');
$pdf->Cell(190, 5, '', 0, 1, 'C');
$pdf->Cell(190, 5, '', 0, 1, 'C');
//date('m/d/Y', $date_from table)
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetX(5);
$pdf->Cell(40, 10, 'Owner Name : ___________________________________________', 0, 1, 'L');
$pdf->SetX(5);
$pdf->Cell(40, 10, 'Address : _________________________________________________________________________________________', 0, 1, 'L');
$pdf->SetX(22);
$pdf->Cell(40, 10, '_________________________________________________________________________________________', 0, 1, 'L');
$pdf->SetX(5);
$pdf->Cell(40, 10, 'Age : __________', 0, 0, 'L');
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(60, 10, 'Nationality : __________________', 0, 0, 'L');
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(40, 10, 'TIN : __________________', 0, 1, 'L');
$pdf->SetX(5);
$pdf->Cell(40, 10, 'Business Name : _____________________________________________________', 0, 1, 'L');
$pdf->SetX(5);
$pdf->Cell(40, 10, 'Address : _________________________________________________________________________________________', 0, 1, 'L');
$pdf->SetX(22);
$pdf->Cell(40, 10, '_________________________________________________________________________________________', 0, 1, 'L');
$pdf->SetX(5);
$pdf->Cell(80, 10, 'Capital Investment : ________________________', 0, 0, 'L');
$pdf->SetX($pdf->GetX() + 20);
$pdf->Cell(80, 10, 'Gross Receipts : ________________________', 0, 1, 'L');
$pdf->SetX(5);
$pdf->Cell(80, 10, 'Type of Ownership : ________________________', 0, 0, 'L');
示例#14
0
 function __construct($lineItems, $lineItemTotals, $filename, $save = false)
 {
     App::import('vendor', 'fpdf/fpdf');
     $orientation = 'P';
     $unit = 'pt';
     $format = 'A4';
     $margin = 40;
     $pdf = new FPDF($orientation, $unit, $format);
     App::import('Helper', 'Time');
     $timeHelper = new TimeHelper();
     setlocale(LC_MONETARY, 'th_TH');
     $pdf->AddPage();
     $pdf->SetTopMargin($margin);
     $pdf->SetLeftMargin($margin);
     $pdf->SetRightMargin($margin);
     $pdf->SetAutoPageBreak(true, $margin);
     $pdf->SetY($pdf->GetY() + 60);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->SetTextColor(0);
     $pdf->SetFillColor(255);
     $pdf->SetLineWidth(1);
     $pdf->SetFont('Arial', 'B', '10');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 30;
     $pdf->MultiCell($cell_width, 25, "No.\n ", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $pdf->Cell(250, 25, "Description", 'LTR', 0, 'C');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "# Ordered", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "# Supplied", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount Wholesale", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount Retail", 'LTR', 'C');
     $pdf->SetY($pdf->GetY() - 25);
     $pdf->SetFont('Arial', '');
     $pdf->SetFillColor(238);
     $pdf->SetLineWidth(0.2);
     $pdf->SetY($pdf->GetY() + 25);
     $num = 1;
     $number_ordered = 0;
     $number_supplied = 0;
     foreach ($lineItems as $lineItem) {
         $pdf->Cell(30, 20, $num++, 1, 0, 'L');
         $pdf->Cell(250, 20, $lineItem['Product']['short_description'], 1, 0, 'L');
         $pdf->Cell(48, 20, $lineItem['LineItem']['ordered'], 1, 0, 'R');
         $pdf->Cell(48, 20, $lineItem['LineItem']['supplied'], 1, 0, 'R');
         $pdf->Cell(70, 20, money_format("%i", $lineItem['LineItem']['amount_wholesale']), 1, 0, 'R');
         $pdf->Cell(70, 20, money_format("%i", $lineItem['LineItem']['amount_retail']), 1, 1, 'R');
     }
     $pdf->SetX($pdf->GetX() + 30);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(250, 20, "TOTALS", 1);
     $pdf->SetFont('Arial', '');
     $pdf->Cell(48, 20, $lineItemTotals['LineItem']['ordered'], 1, 0, 'R');
     $pdf->Cell(48, 20, $lineItemTotals['LineItem']['ordered'], 1, 0, 'R');
     $pdf->Cell(70, 20, money_format("%i", $lineItemTotals['LineItem']['amount_wholesale']), 1, 0, 'R');
     $pdf->Cell(70, 20, money_format("%i", $lineItemTotals['LineItem']['amount_retail']), 1, 1, 'R');
     if ($save) {
         $pdf->Output($filename, 'F');
     } else {
         $pdf->Output($filename, 'I');
     }
 }
示例#15
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;
 }
示例#16
0
 /**
  * Get the data needed for a downloadable version of the report (all data,
  * no paging necessary) and format it accordingly for the download file
  * type.
  *
  * NOTE: It is expected that the valid format types will be overridden in
  * an extended report class as the array is empty by default.
  *
  * @param string $format A valid format type.
  */
 function download($format)
 {
     global $CFG;
     $output = '';
     if (empty($this->data)) {
         return $output;
     }
     $filename = !empty($this->title) ? $this->title : 'report_download';
     switch ($format) {
         case 'csv':
             $filename .= '.csv';
             header("Content-Transfer-Encoding: ascii");
             header("Content-Disposition: attachment; filename={$filename}");
             header("Content-Type: text/comma-separated-values");
             $row = array();
             foreach ($this->headers as $header) {
                 $row[] = $this->csv_escape_string(strip_tags($header));
             }
             echo implode(',', $row) . "\n";
             foreach ($this->data as $datum) {
                 if (!is_object($datum)) {
                     continue;
                 }
                 $row = array();
                 foreach ($this->headers as $id => $header) {
                     if (isset($datum->{$id})) {
                         $row[] = $this->csv_escape_string($datum->{$id});
                     } else {
                         $row[] = '""';
                     }
                 }
                 echo implode(',', $row) . "\n";
             }
             break;
         case 'excel':
             require_once $CFG->libdir . '/excellib.class.php';
             $filename .= '.xls';
             /// Creating a workbook
             $workbook = new MoodleExcelWorkbook('-');
             /// Sending HTTP headers
             $workbook->send($filename);
             /// Creating the first worksheet
             $sheettitle = get_string('studentprogress', 'reportstudentprogress');
             $myxls =& $workbook->add_worksheet($sheettitle);
             /// Format types
             $format =& $workbook->add_format();
             $format->set_bold(0);
             $formatbc =& $workbook->add_format();
             $formatbc->set_bold(1);
             $formatbc->set_align('center');
             $formatb =& $workbook->add_format();
             $formatb->set_bold(1);
             $formaty =& $workbook->add_format();
             $formaty->set_bg_color('yellow');
             $formatc =& $workbook->add_format();
             $formatc->set_align('center');
             $formatr =& $workbook->add_format();
             $formatr->set_bold(1);
             $formatr->set_color('red');
             $formatr->set_align('center');
             $formatg =& $workbook->add_format();
             $formatg->set_bold(1);
             $formatg->set_color('green');
             $formatg->set_align('center');
             $rownum = 0;
             $colnum = 0;
             foreach ($this->headers as $header) {
                 $myxls->write($rownum, $colnum++, $header, $formatbc);
             }
             foreach ($this->data as $datum) {
                 if (!is_object($datum)) {
                     continue;
                 }
                 $rownum++;
                 $colnum = 0;
                 foreach ($this->headers as $id => $header) {
                     if (isset($datum->{$id})) {
                         $myxls->write($rownum, $colnum++, $datum->{$id}, $format);
                     } else {
                         $myxls->write($rownum, $colnum++, '', $format);
                     }
                 }
             }
             $workbook->close();
             break;
         case 'pdf':
             require_once $CFG->libdir . '/fpdf/fpdf.php';
             $filename .= '.pdf';
             $newpdf = new FPDF('L', 'in', 'letter');
             $marginx = 0.75;
             $marginy = 0.75;
             $newpdf->setMargins($marginx, $marginy);
             $newpdf->SetFont('Arial', '', 9);
             $newpdf->AddPage();
             $newpdf->SetFont('Arial', '', 16);
             $newpdf->MultiCell(0, 0.2, $this->title, 0, 'C');
             $newpdf->Ln(0.2);
             $newpdf->SetFont('Arial', '', 8);
             $newpdf->SetFillColor(225, 225, 225);
             $heights = array();
             $widths = array();
             $hmap = array();
             $rownum = 0;
             /// PASS 1 - Calculate sizes.
             foreach ($this->headers as $id => $header) {
                 $widths[$id] = $newpdf->GetStringWidth($header) + 0.2;
             }
             $row = 0;
             foreach ($this->data as $datum) {
                 if (!isset($heights[$row])) {
                     $heights[$row] = 0;
                 }
                 foreach ($this->headers as $id => $header) {
                     if (isset($datum->{$id})) {
                         $width = $newpdf->GetStringWidth($datum->{$id}) + 0.2;
                         if ($width > $widths[$id]) {
                             $lines = ceil($width / $widths[$id]);
                             $widths[$id] = $width;
                         } else {
                             $lines = 1;
                         }
                         $height = $lines * 0.2;
                         if ($height > $heights[$row]) {
                             $heights[$row] = $height;
                         }
                     }
                 }
                 $row++;
             }
             /// Calculate the width of the table...
             $twidth = 0;
             foreach ($widths as $width) {
                 $twidth += $width;
             }
             /// Readjust the left margin according to the total width...
             $marginx = (11.0 - $twidth) / 2.0;
             $newpdf->setMargins($marginx, $marginy);
             foreach ($this->headers as $id => $header) {
                 $text = str_replace(' ', "\n", $header);
                 $newpdf->Cell($widths[$id], 0.2, "{$text}", 1, 0, 'C', 1);
             }
             $newpdf->Ln();
             $row = 0;
             foreach ($this->data as $datum) {
                 if (is_array($datum) && strtolower($datum[0]) == 'hr') {
                     $curx = $newpdf->GetX();
                     $cury = $newpdf->GetY() + 0.1;
                     $endx = 0;
                     $endy = $cury;
                     foreach ($widths as $width) {
                         $endx += $width;
                     }
                     $newpdf->Line($curx, $cury, $endx, $endy);
                     $newpdf->SetX($curx + 0.1);
                 } else {
                     foreach ($this->headers as $id => $header) {
                         $text = '';
                         if (isset($datum->{$id})) {
                             $text = $datum->{$id};
                         }
                         $newpdf->Cell($widths[$id], $heights[$row], $text, 0, 0, 'C', 0);
                     }
                 }
                 $newpdf->Ln();
                 $row++;
             }
             $newpdf->Output($filename, 'I');
             break;
         default:
             return $output;
             break;
     }
 }
示例#17
0
	$pdf->Image("http://www.provinciart.com.ar/images/provart_blanco.png", 6, NULL, 50, 17);

	$pdf->Ln(-4);
	$pdf->Cell(64);
	$pdf->SetFont("Arial", "B", 14);
	$pdf->Cell(68, 0, "Estado de Situación de Pagos");

	$pdf->Cell(12);
	$pdf->SetFont("Arial", "B", 8);
	$pdf->Cell(28, 0, "Cuenta Corriente al");

	$pdf->SetFont("Arial", "", 8);
	$pdf->Cell(0, 0, $row["CTACTE_AL"]);

	$pdf->Ln(3);
	$pdf->Line($pdf->GetX(), $pdf->GetY(), 200, $pdf->GetY());

	$pdf->Ln(2);
	$pdf->Cell(0, 0, "Según resolución SRT 441/06", 0, 0, "C");

	// Datos del cliente..
	$pdf->Ln(8);
	$pdf->SetFont("Arial", "B", 8);
	$pdf->Cell(0, 0, "Datos del Cliente");

	$pdf->Ln(4);
	$pdf->SetFont("Arial", "B", 8);
	$pdf->Cell(20, 0, "C.U.I.T.");

	$pdf->SetFont("Arial", "", 8);
	$pdf->Cell(168, 0, $row["CUIT"]);
示例#18
0
$pdf->SetXY(0, 30);
$pdf->Cell(0, 0, "SAMPLE DOC Oumar Exe ", 0, 0, C);
$pdf->SetFont("Arial", "", 12);
$pdf->SetTextColor(130, 0, 0);
$pdf->Text(10, 45, "Title 1 ");
$pdf->SetTextColor(0);
$pdf->SetTextColor(0, 130, 0);
$pdf->Text(20, 50, "Title 2 ");
$pdf->SetTextColor(0);
$pdf->SetTextColor(20, 20, 130);
$pdf->Text(30, 55, "Title 3 ");
$pdf->SetTextColor(0);
$pdf->SetXY(10, 60);
$pdf->Text(10, 60, "BONJOUR COUCOU GRAND Darktsar Oumar Exe TRAORE  ");
$cordX = $pdf->SetX($pdf->GetStringWidth("BONJOUR COUCOU GRAND Darktsar Oumar Exe TRAORE  "));
$cordX = $pdf->GetX() + 9;
$pdf->SetFont("Arial", "B", 12);
$pdf->Text($cordX, 60, "SAMPLE ");
$pdf->SetFont("Arial", "", 12);
$pdf->SetFont("Arial", "", 12);
$cordX = $pdf->SetX($pdf->GetStringWidth("SAMPLE ")) + 18 + $cordX;
$pdf->Text($cordX, 60, " Fin de texte darktsar");
$pdf->SetXY(10, 65);
$pdf->SetFont("Arial", "I", 12);
$pdf->Text(10, 65, "SAMPLE ");
$pdf->SetFont("Arial", "", 12);
$pdf->SetTextColor(0, 130, 0);
$pdf->Text(20, 70, "Titre super ");
$pdf->SetTextColor(0);
$pdf->SetXY(10, 75);
$pdf->Text(10, 75, "Je teste le underline ");
示例#19
0
 function __construct($products, $order, $filename, $save = false)
 {
     App::import('vendor', 'fpdf/fpdf');
     $orientation = 'P';
     $unit = 'pt';
     $format = 'A4';
     $margin = 40;
     $pdf = new FPDF($orientation, $unit, $format);
     App::import('Helper', 'Time');
     $timeHelper = new TimeHelper();
     setlocale(LC_MONETARY, 'th_TH');
     $pdf->AddPage();
     $pdf->SetTopMargin($margin);
     $pdf->SetLeftMargin($margin);
     $pdf->SetRightMargin($margin);
     $pdf->SetAutoPageBreak(true, $margin);
     $pdf->SetY($pdf->GetY() + 60);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->SetTextColor(0);
     $pdf->SetFillColor(255);
     $pdf->SetLineWidth(1);
     $pdf->Cell(50, 25, "Order ID: ", 'LT', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(50, 25, $order['Order']['id'], 'T', 0, 'L');
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(100, 25, 'Customer Name: ', 'T', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(316, 25, $order['User']['name'], 'TR', 1, 'L');
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(100, 25, "Delivery Date: ", 'LT', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(416, 25, $timeHelper->format($format = 'd-m-Y', $order['Delivery']['date']), 'TR', 1, 'L');
     $pdf->SetFont('Arial', 'B', '10');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 30;
     $pdf->MultiCell($cell_width, 25, "No.\n ", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $pdf->Cell(250, 25, "Description", 'LTR', 0, 'C');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "Number Ordered", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "Number Supplied", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount per Unit", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount\n ", 'LTR', 'C');
     $pdf->SetY($pdf->GetY() - 25);
     $pdf->SetFont('Arial', '');
     $pdf->SetFillColor(238);
     $pdf->SetLineWidth(0.2);
     $pdf->SetY($pdf->GetY() + 25);
     $num = 1;
     $number_ordered = 0;
     $number_supplied = 0;
     foreach ($products as $product) {
         $pdf->Cell(30, 20, $num++, 1, 0, 'L');
         $pdf->Cell(250, 20, $product['Product']['short_description'], 1, 0, 'L');
         $pdf->Cell(48, 20, $product['LineItem']['quantity'], 1, 0, 'R');
         $number_ordered += $product['LineItem']['quantity'];
         $pdf->Cell(48, 20, $product['LineItem']['quantity_supplied'], 1, 0, 'R');
         $number_supplied += $product['LineItem']['quantity_supplied'];
         $pdf->Cell(70, 20, money_format("%i", $product['Product']['selling_price']), 1, 0, 'R');
         $pdf->Cell(70, 20, money_format("%i", $product['LineItem']['total_price_supplied']), 1, 1, 'R');
     }
     $pdf->SetX($pdf->GetX() + 30);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(250, 20, "TOTALS", 1);
     $pdf->SetFont('Arial', '');
     $pdf->Cell(48, 20, $number_ordered, 1, 0, 'R');
     $pdf->Cell(48, 20, $number_supplied, 1, 0, 'R');
     $pdf->Cell(70, 20, "N.A.", 1, 0, 'R');
     $pdf->Cell(70, 20, money_format("%i", $order['Order']['total_supplied']), 1, 1, 'R');
     $pdf->SetY($pdf->GetY() + 25);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Amount Paid: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total']), 0, 1);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Actual Amount: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total_supplied']), 0, 1);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Rebate Amount: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total'] - $order['Order']['total_supplied']), 0, 1);
     if ($save) {
         $pdf->Output($filename, 'F');
     } else {
         $pdf->Output($filename, 'I');
     }
 }
示例#20
0
    $pdf->SetFont('Times','',12);

// cell berukuran 20tinggi_awal10 mm, tanpa border, teks berikutnya akan
// diletakkan di bawah teks ini, posisi teks center dalam cell
/*
    $pdf->Cell(100,100,"Text inside first column",1,0,'L');
    $pdf->SetX($pdf->GetX() - 100);
    $pdf->Cell(35,35,'Text inside second column ',1,0,'C');*/

    $tinggi_awal = 20;
    $tinggi_tengah = 60;
    $lebar_awal = 60;
    $lebar_total = 180;

    $pdf->Cell($lebar_awal,$tinggi_awal,$pdf->Image('assets/img/logoairnav.jpg',13,12,14),1,0,'L');
    $pdf->SetX($pdf->GetX() - 40);
    $pdf->Cell(40,$tinggi_awal,"Airnav Indonesia",0,0,'L');

    $pdf->Cell(120,$tinggi_awal,'Teks 1',1,1,'R');
    $pdf->Cell($lebar_total,$tinggi_awal,'Teks 1',1,1,'C');
    $pdf->Cell($lebar_awal,$tinggi_tengah,'Teks 1',1,0,'L');
    $pdf->Cell(90,$tinggi_tengah,'Teks 1',1,0,'L');
    $pdf->Cell(30,$tinggi_tengah,'Teks 1',1,1,'L');
    $pdf->Cell($lebar_total,$tinggi_awal,'Teks 1',1,1,'L');
    $pdf->Cell($lebar_awal,$tinggi_tengah,'Teks 1',1,0,'L');
    $pdf->Cell(($lebar_total-$lebar_awal),$tinggi_tengah,'Teks 1',1,1,'L');
/* cell berukuran 40tinggi_awal10 mm, dengan border, teks berikutnya akan
// diletakkan pada posisi awal baris berikutnya, teks berada di kanan
// dalam cell
    $pdf->Cell(40,10,'Teks 2',1,1,'R');
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(10, 12, "No. :", "", 0, 'L');
 $pdf->SetFont("Times", "B", 10);
 $pdf->Cell(0, 12, "{$paymentvoucher_prefix}{$paymentvoucher_no}", "", 0, 'R');
 //paymentvoucher Date label block (5)
 $pdf->SetXY($xmargin + 145, 18);
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(10, 12, "Date :", "", 0, 'L');
 $pdf->SetFont("times", "B", 10);
 $pdf->Cell(0, 12, "{$paymentvoucher_date}", "", 0, 'R');
 //paymentvoucher From label block (6)
 $pdf->SetXY($xmargin, 30);
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(30, 12, "PAID TO :", "", 0, 'L');
 $pdf->SetFont("Times", "B", 12);
 $pdf->Line($pdf->GetX(), $pdf->GetY() + 9, $pdf->GetX() + 155, $pdf->GetY() + 9);
 $pdf->Cell(0, 12, "{$paidto}", "", 0, 'L');
 //paymentvoucher AMT in Text label block (7)
 $pdf->SetXY($xmargin, 38);
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell($xmargin + 15, 12, "THE SUM OF :", "", 0, 'L');
 $pdf->Line($pdf->GetX(), $pdf->GetY() + 9, $pdf->GetX() + 155, $pdf->GetY() + 9);
 //$pdf->Line($pdf->GetX(),86,$pdf->GetX()+150,86);
 $pdf->MultiCell(0, 12, "{$currency_code} " . convertNumber($originalamt), "", 'L');
 //paymentvoucher AMT in Text label block (8)
 $pdf->SetXY($xmargin, 45);
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(30, 12, "DESCRIPTION :", "", 0, 'L');
 $pdf->SetFont("Arial", "", 10);
 $pdf->Line($pdf->GetX(), $pdf->GetY() + 9, $pdf->GetX() + 155, $pdf->GetY() + 9);
 $pdf->Line($pdf->GetX(), $pdf->GetY() + 16, $pdf->GetX() + 155, $pdf->GetY() + 16);
示例#22
0
 $pdf->Cell(10, 12, "No. :", "", 0, 'L');
 $pdf->SetFont("Times", "B", 10);
 $pdf->Cell(0, 12, "{$receipt_prefix}{$receipt_no}", "", 0, 'R');
 //paymentvoucher Date label block (5)
 $pdf->SetXY($xmargin + 145, 18);
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(10, 12, "Date :", "", 0, 'L');
 $pdf->SetFont("times", "B", 10);
 $pdf->Cell(0, 12, "{$receipt_date}", "", 0, 'R');
 //Receipt From label block (6)
 $pdf->SetXY(10, 30);
 // ori Y=60
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(40, 12, "Received From :", "", 0, 'L');
 $pdf->SetFont("Times", "B", 10);
 $pdf->Line($pdf->GetX(), $pdf->GetY() + 9, $pdf->GetX() + 150, $pdf->GetY() + 9);
 $pdf->Cell(0, 12, "{$paidfrom}", "", 0, 'L');
 //Receipt AMT in Text label block (7)
 $pdf->SetXY(10, 38);
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(40, 12, "The Sum Of :", "", 0, 'L');
 $pdf->SetFont("Times", "", 10);
 $pdf->Line($pdf->GetX(), $pdf->GetY() + 9, $pdf->GetX() + 150, $pdf->GetY() + 9);
 //$pdf->Line($pdf->GetX(),86,$pdf->GetX()+150,86);
 //echo ucwords("SAAAS SDA asDDS");
 $txt_sum = ucwords(strtolower(convertNumber($originalamt)));
 $pdf->MultiCell(0, 10, $currency_code . " " . $txt_sum, "", 'L');
 //Receipt AMT in Text label block (8)
 $pdf->SetXY(10, 45);
 $pdf->SetFont("Times", "", 10);
 $pdf->Cell(40, 10, "Description :", "", 0, 'L');
示例#23
0
$header1 = "Kementrian Keuangan Republik Indonesia\nDirektorat Jenderal Bea dan Cukai\nKantor Pelayanan Utama Tipe B Batam.";
$pdf->Line(10, 17, 83, 17);
$pdf->setX(10);
$pdf->MultiCell(70, 5, $header1, 1, 'C');
$pdf->Ln(3);
$header2 = "DAFTAR BARANG-BARANG IMPOR\nYANG DINYATAKAN SEBAGAI BARANG YANG\nTIDAK DIKUASAI";
$pdf->Line(10, 17, 83, 17);
$pdf->setX(100);
$pdf->MultiCell(100, 4, $header2, 0, 'C');
$pdf->Ln(5);
$pdf->cell(15, 5, 'Nomor :', 0, 0, 'L', 0);
$pdf->cell(11, 5, $bcf15no, 0, 0, 'L', 0);
$pdf->cell(20, 5, $kd_manifest, 0, 0, 'L', 0);
$pdf->Ln(5);
$pdf->cell(10, 20, 'No', 1, 0, 'C', 0);
$posisi_x = $pdf->GetX();
$pdf->cell(60, 10, 'BC 1.1', 1, 1, 'C', 0);
$pdf->setX($posisi_x);
$pdf->Cell(20, 10, 'No', 1, 0);
$pdf->Cell(30, 10, 'Tanggal', 1, 0);
$pdf->Cell(10, 10, 'Pos', 1, 1);
$pdf->setY(42);
$pdf->setX(72);
$pdf->multicell(32, 10, 'Nama Sarana Pengangkut', 1, 'C');
$pdf->setY(42);
$pdf->setX(104);
$posisi_x = $pdf->GetX();
$pdf->cell(30, 10, 'Jumlah dan jenis', 1, 1, 'C', 0);
$pdf->setX($posisi_x);
$pdf->Cell(15, 10, 'Jumlah', 1, 0);
$pdf->Cell(15, 10, 'Jenis', 1, 0);