本文整理汇总了PHP中FPDF::GetX方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDF::GetX方法的具体用法?PHP FPDF::GetX怎么用?PHP FPDF::GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPDF
的用法示例。
在下文中一共展示了FPDF::GetX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* 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()
);
//.........这里部分代码省略.........
示例2: genpdf
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();
}
示例3: CreatePDFRendering
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: parse_pdf_content
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;
//.........这里部分代码省略.........
示例5: pathinfo
$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:
$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");
示例7: round
$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);
示例8: report_head
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: date
//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");
示例10:
$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);
示例11: getSettingValue
{
$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: get_receipt
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:
$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: FPDF
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: xml2pdf
//.........这里部分代码省略.........
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;
}