本文整理汇总了PHP中FPDF::write方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDF::write方法的具体用法?PHP FPDF::write怎么用?PHP FPDF::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPDF
的用法示例。
在下文中一共展示了FPDF::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
public function download($page = 'noticeview')
{
define('FPDF_FONTPATH', APPPATH . 'plugins/fpdf/font/');
require APPPATH . 'plugins/fpdf/fpdf.php';
$this->load->helper('url');
if (!file_exists(APPPATH . '/views/noticeboard/' . $page . '.php')) {
show_404();
}
$data['title'] = ucfirst($page);
// Capitalize the first letter
$data['name'] = "Nayeem";
$id = $_GET['id'];
$file = base_url() . 'uploads/' . $id . '.jpg';
$type = ".jpg";
if (@getimagesize($file)) {
$size = getimagesize($file);
} else {
$type = ".png";
$file = base_url() . 'uploads/' . $id . '.png';
$size = getimagesize(base_url() . 'uploads/' . $id . '.png');
}
//$pdf = new FPDF('p','mm',array(210,300));
if ($size[0] > $size[1]) {
$style = 'l';
} else {
$style = 'p';
}
$pdf = new FPDF($style, 'pt', array($size[0] * 3 / 4, $size[1] * 3 / 4));
$pdf->AddPage();
$pdf->setDisplayMode('fullpage');
//$pdf -> Image(base_url().'uploads/'.$id.'.png',20,20,170,260);
$pdf->Image(base_url() . 'uploads/' . $id . "" . $type, 0, 0, 0, 0);
// $pdf -> setFont ('times','B',20);
// $pdf -> cell(200,30,"Title",0,1);
$pdf->setFont('times', 'B', '20');
$pdf->write(10, "{$size['0']}, {$size['1']}");
$pdf->output($id . '.pdf', 'D');
//header('Location: ' .base_url(). 'index.php/noticeview/show?id='.$id);
}
示例2: generate_pdf
private function generate_pdf($srcText, $dest)
{
// Set some document variables
$author = "";
$x = 50;
$text = "<<<EOT" . $srcText . "EOT";
// Create fpdf object
$pdf = new FPDF('P', 'pt', 'Letter');
// Set base font to start
$pdf->SetFont('Times', 'B', 24);
// Add a new page to the document
$pdf->addPage();
// Set the x,y coordinates of the cursor
$pdf->SetXY($x, 50);
// Write 'Simple PDF' with a line height of 1 at the current position
$pdf->Write(25, 'Simple PDF');
// Reset the font
$pdf->SetFont('Courier', 'I', 10);
// Set the font color
$pdf->SetTextColor(255, 0, 0);
// Reset the cursor, write again.
$pdf->SetXY($x, 75);
$pdf->Cell(0, 11, "By: {$author}", 'B', 2, 'L', false);
// Place an image on the pdf document
//$pdf->Image('graph.jpg', $x, 100, 150, 112.5, 'JPG');
// Reset font, color, and coordinates
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY($x, 250);
// Write out a long text blurb.
$pdf->write(13, $srcText);
// echo "<pre>";
// print_r($pdf);exit;
$fileName = substr($dest, 0, strpos($dest, '.')) . "_" . time() . '.pdf';
$pdf->Output($fileName, 'F');
}
示例3: FPDF
$x = 50;
$text = <<<EOT
facilisis Praesent ultricies vitae, placerat dapibus, turpis commodo morbi tristique erat et amet egestas. faucibus, lacus Quisque amet, est amet erat. facilisis. Aliquam eget, quam tincidunt ipsum sagittis eros vitae eu Vestibulum cursus dui pharetra. erat metus condimentum felis. pulvinar Vestibulum ac habitant neque rutrum feugiat quam, leo. elit tincidunt id Pellentesque sapien sit condimentum, accumsan vitae, eu egestas eget tortor turpis sit dui. neque wisi. ultricies Nam augue, est. porttitor, et eu fermentum, egestas ac ullamcorper tortor enim ante. netus eros luctus, malesuada amet, magna orci, Aenean in vulputate libero quis, non sit Mauris wisi, volutpat. sed, tempus et eleifend fames Donec sit semper. Aenean mi mi, ornare enim tempor Ut Donec senectus.
EOT;
// Create fpdf object
$pdf = new FPDF('P', 'pt', 'Letter');
// Set base font to start
$pdf->SetFont('Times', 'B', 24);
// Add a new page to the document
$pdf->addPage();
// Set the x,y coordinates of the cursor
$pdf->SetXY($x, 50);
// Write 'Simple PDF' with a line height of 1 at the current position
$pdf->Write(25, 'Simple PDF');
// Reset the font
$pdf->SetFont('Courier', 'I', 10);
// Set the font color
$pdf->SetTextColor(255, 0, 0);
// Reset the cursor, write again.
$pdf->SetXY($x, 75);
$pdf->Cell(0, 11, "By: {$author}", 'B', 2, 'L', false);
// Place an image on the pdf document
$pdf->Image('graph.jpg', $x, 100, 150, 112.5, 'JPG');
// Reset font, color, and coordinates
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY($x, 250);
// Write out a long text blurb.
$pdf->write(13, $text);
// Close the document and save to the filesystem with the name simple.pdf
$pdf->Output('/simple1.pdf', 'F');
示例4: FPDF
<?php
require_once 'fpdf.php';
define('FPDF_FONTPATH', './font/');
//Zeichensatz anzeigen im PDF
$font = 'ORION';
$pdf = new FPDF();
$pdf->AddFont($font, '', $font . '.php');
$pdf->SetFont($font, '', 15);
$pdf->Open();
$pdf->AddPage();
$pdf->setFontSize(15);
for ($i = 32; $i < 256; $i++) {
$text .= " #{$i}: " . chr($i);
}
$pdf->write(10, $text);
$pdf->output('test.pdf');
示例5: file
Title : PHP program to write binary file (pdf)
Content:
Name:
Matrix No:
Gender:
Age:
E-mails:
Mobile Phone:
*/
require "fpdf/fpdf.php";
$pdf = new FPDF();
///var_dump(get_class_method($pdf));
$pdf->AddPage();
//$pdf->Image('sifu.jpg');
$pdf->SetFont("Arial", "B", "20");
$pdf->Cell(0, 10, "My PDF PAGE", 1, 1, "C");
$pdf->SetFont("Arial", "I", "15");
$pdf->Cell(0, 10, "My Name Azhari Hj Salleh", 1, 1, "C");
$pdf->SetFont("Arial", "I", "15");
$pdf->Cell(0, 10, "Matrix No : 2014461166 ", 1, 1, "C");
$pdf->SetFont("Arial", "I", "15");
$pdf->Cell(0, 10, "Gender : Male ", 1, 1, "C");
$pdf->SetFont("Arial", "I", "15");
$pdf->Cell(0, 10, "Age : 40 ", 1, 1, "C");
$pdf->SetFont("Arial", "I", "15");
$pdf->Cell(0, 10, "Email : azhari@gmail.com ", 1, 1, "C");
$pdf->SetFont("Arial", "I", "15");
$pdf->Cell(0, 10, "Mobile No : 01366666666 ", 1, 1, "C");
$pdf->SetFont("", "", "20");
$pdf->write(5, "");
$pdf->Output('azhari.pdf');
示例6:
elegir entre los diferentes formatos de página que existen: A3, A4, A5, Letter
y Legal.*/
//MEtodos de la clase
//var_dump(get_class_methods($pdf));
//PAGINA 1: Write
$pdf->AddPage();
//añade una página al documento con la orientación que le pida
$pdf->SetFont('Arial', 'B', 15);
//selecciona una fuente tomando como parámetro el tipo, la propiedad (negrita, cursiva) y el tamaño
$pdf->Write(155, ' Mi primer documento!!!');
//Write(altura,texto,enlace)-> Imprime el texto pasado como parámetro en la posición que indica el cursor.
$pdf->SetFont('Helvetica', 'I', 15);
//selecciona una fuente tomando como parámetro el tipo, la propiedad (negrita, cursiva) y el tamaño
$pdf->Write(165, ' Mi primer documento!!!');
$pdf->SetFont('Arial', '', 15);
//selecciona una fuente tomando como parámetro el tipo, la propiedad (negrita, cursiva) y el tamaño
$pdf->Write(180, ' Mi primer documento!!!', "http://www.googles.es");
//PAGINA 2: La Celda
$pdf->AddPage();
$pdf->SetFont('Courier', '', 10);
$pdf->Cell(80);
$pdf->Cell(20, 10, 'Titulo', 'LR', 1, 'C');
$pdf->Cell(50);
$pdf->Cell(40, 10, 'Enlace a google', 1, 1, 'C', 0, "http://www.google.es");
//PAGINA 3: El cursor
$pdf->AddPage();
$pdf->SetXY(100, 100);
//SetX () y S e tY () colocan el texto en el punto indicado, en la medida seleccionada
$pdf->write(20, "Este texto se mostrará a 10 cm del margen");
$pdf->Output();
//Genera el PDF
示例7: FPDF
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
require "../fpdf/fpdf.php";
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Times', '', 14);
$pdf->write(5, 'For a link to page 2 - Click ');
$pdf->SetFont('', 'U');
$pdf->SetTextColor(0, 0, 255);
$link_to_pg2 = $pdf->AddLink();
$pdf->write(5, 'here', $link_to_pg2);
$pdf->SetFont('');
//Second page
$pdf->AddPage();
$pdf->SetLink($link_to_pg2);
$pdf->Image('http://i1-scripts.softpedia-static.com/ico/php.gif', 10, 10, 30, 0, '', 'http://www.php.net');
$pdf->ln(20);
$pdf->SetTextColor(1);
$pdf->Cell(0, 5, 'This is a link and a clickable image', 0, 1, 'L');
$pdf->SetFont('', 'U');
$pdf->SetTextColor(0, 0, 255);
$pdf->Write(5, 'www.oreilly.com', 'http://www.oreilly.com');
示例8: FPDF
<?php
require_once 'fpdf16/fpdf.php';
// $orientação (P|L), $unidade (cm, mm, etc), $folha (A4, Letter, etc)
$pdf = new FPDF('P', 'cm', 'A4');
// título do documento
$pdf->SetTitle('Arquivo teste - PHP Advanced II');
// autor do documento
$pdf->SetAuthor('Charles Schaefer - PHPrime');
// Adiciona a primeira página, tipo retrato
$pdf->AddPage('P');
// Indica a fonte que vai ser utilizada
$pdf->SetFont('Arial', 'B', 14);
// indica a cor do texto (r, g, b)
$pdf->SetTextColor(250, 0, 0);
// Posição do texto
$pdf->SetXY(5, 5);
// Escreve o texto
// $altura_linha, $texto
$pdf->Write(0.5, 'Gerando arquivos PDF com FPDF');
// Quebra de linha no arquivo ($altura)
$pdf->Ln(1);
$pdf->write(1, 'Texto simples, de introdução');
// $x, $y, $texto
$pdf->Text(1, 8, 'Dessa vez utilizando o método Text()');
$pdf->Output('/tmp/teste.pdf');
示例9:
$pdf->AddPage();
$pdf->SetFont("Arial", "", "20");
$pdf->Cell(0, 1, "Extrait Bancaire", 0, 0, 'C');
$id = $_GET["id"];
$client->setId($id);
$liste_client = $client->liste_info_client();
foreach ($liste_client as $row) {
$ncin = $row["ncin"];
$nom = $row["nom"];
$prenom = $row["prenom"];
}
$nomG = "Nom: " . $nom;
$prenomG = "Nom: " . $prenom;
$ncinG = "N C I N : " . $ncin;
$pdf->SetFont("Arial", "", "15");
$pdf->write(30, $nomG, "L");
$pdf->Ln(10);
$pdf->write(30, $prenomG, "L");
$pdf->Ln(10);
$pdf->write(30, $ncinG, "L");
$pdf->Ln(10);
$compte->setId_client($id);
$liste = $compte->liste_info_compte();
foreach ($liste as $row) {
$rib = $row["RIB"];
$type = $row["type"];
}
$ribG = "R I B :" . $rib;
$typeG = "Type :" . $type;
$pdf->write(30, $ribG, "L");
$pdf->Ln(10);
示例10: kalkulu_partoprenantojn
$inoj += $seksagxo[i][$i];
$viroj += $seksagxo[v][$i];
}
$pdf->SetFontSize(12);
$pdf->text(31, 240, $inoj);
$pdf->text(41, 240, $viroj);
function kalkulu_partoprenantojn($speco, $valoro)
{
// TODO: Esploru, cxu la GROUP BY vere necesas.
$row = mysql_fetch_array(sql_faru(datumbazdemando(array($speco, "count(*)" => "c"), array("partoprenoj" => "p"), array("{$speco} = '{$valoro}'", "alvenstato = 'a'"), "renkontigxoID", array("group" => "{$speco}"))), MYSQL_BOTH);
return $row["c"];
}
//nombro de vegetaranoj:
//// "Select vegetare, count(*) as c from partoprenoj as p where vegetare='J' and alvenstato='a' and renkontigxoID='".$_SESSION["renkontigxo"]->datoj[ID]."' group by vegetare"
$pdf->setXY(110, 40);
$pdf->write(9, 'vegetaranoj: ' . kalkulu_partoprenantojn("vegetare", "J"));
// $row=mysql_fetch_array(sql_faru("Select partoprentipo, count(*) as c from partoprenoj as p where partoprentipo='p' and alvenstato='a' and renkontigxoID='".$_SESSION["renkontigxo"]->datoj[ID]."' group by partoprentipo"),MYSQL_NUM);
$pdf->setXY(110, 45);
$pdf->write(9, 'partpartoprenantoj:' . kalkulu_partoprenantojn("partoprentipo", "p"));
// $row=mysql_fetch_array(sql_faru("Select komencanto, count(*) as c from partoprenoj as p where komencanto='J' and alvenstato='a' and renkontigxoID='".$_SESSION["renkontigxo"]->datoj[ID]."' group by komencanto"),MYSQL_NUM);
$pdf->setXY(110, 50);
$pdf->write(9, 'komencantoj:' . kalkulu_partoprenantojn("komencanto", "J"));
// // $row=mysql_fetch_array(sql_faru("Select invitletero, count(*) as c from partoprenoj as p where invitletero='J' and renkontigxoID='".$_SESSION["renkontigxo"]->datoj[ID]."' group by invitletero"),MYSQL_NUM);
// $pdf->setXY(110,55);
// $pdf->write(9,'invitleteroj:'. kalkulu_partoprenantojn("invitletero", "J"));
// TODO: Kial GROUP BY ?
// $row=mysql_fetch_array(sql_faru("Select invitilosendata, count(*) as c from partoprenoj as p where invitilosendata<>'0000-00-00' and alvenstato='a' and renkontigxoID='".$_SESSION["renkontigxo"]->datoj[ID]."' group by renkontigxoID"),MYSQL_NUM);
$row = mysql_fetch_array(sql_faru(datumbazdemando(array("invitilosendata", "count(*)" => "c"), array("partoprenoj" => "p"), array("invitilosendata <> '0000-00-00'", "alvenstato = 'a'"), "renkontigxoID", array("group" => "renkontigxoID"))), MYSQL_BOTH);
$pdf->setXY(110, 60);
$pdf->write(9, '(elsendata:' . $row["c"] . ')');
// $row=mysql_fetch_array(sql_faru("Select retakonfirmilo, count(*) as c from partoprenoj as p where retakonfirmilo='J' and alvenstato='a' and renkontigxoID='".$_SESSION["renkontigxo"]->datoj[ID]."' group by retakonfirmilo"),MYSQL_NUM);
示例11: max
if ($addr_line_width > $max_addr_width) {
$max_addr_width = $addr_line_width;
}
}
$max_line_width = max($name_width, $max_addr_width);
// Center the longest line, and make everything else left justified to that
$left_x = $start_x + $col * ($x_size + $row_sep) + ($x_size - $max_line_width) / 2;
$pdf->SetLeftMargin($left_x);
// Draw the name line
$pdf->SetFont("Astrud", "", NAME_SIZE_PTS);
//$name_width = $pdf->GetStringWidth($name_string);
//$name_x = $start_x + ($col * ($x_size + $row_sep)) + (($x_size - $name_width) / 2);
$name_y = $start_y + $row * $y_size + TOP_MARGIN_IN;
//$pdf->setXY($name_x, $name_y);
$pdf->setXY($left_x, $name_y);
$pdf->write($name_height, $name_string);
// Draw the address lines
$pdf->SetFont("ufonts.com_century-gothic", "", ADDR_SIZE_PTS);
//$address = create_address($parties[$i]);
// Determine the max address line width
/*
$max_addr_width = $pdf->GetStringWidth($address[0]);
for ($j = 1; $j < count($address); ++$j) {
$addr_line_width = $pdf->GetStringWidth($address[$j]);
if ($addr_line_width > $max_addr_width) {
$max_addr_width = $addr_line_width;
}
}
$addr_x = $start_x + ($col * ($x_size + $row_sep)) + (($x_size - $max_addr_width) / 2);
*/
//$pdf->SetLeftMargin($name_x);
示例12: makepdf
//.........这里部分代码省略.........
global $objPDO;
require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php';
$record = new Teacher($objPDO);
if ($user->checkAdmin()) {
$eid = $_GET['uid'];
} else {
$student = new Student($objPDO, $user->getuserId());
$eid = $student->getID();
}
$record->loadByUserId($eid);
// Write out a long text blurb.
//$array=$record->getAsArray();
//$x=0;
/* TEMPLATE 1 DESIGN*/
$pdf->SetFont('Arial', '', 8);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'Employee Id (reference) : ' . $record->getTeacherId(), 0, 1, 'L', true);
$pdf->SetFont('Arial', '', 12);
$pdf->setFillColor(50, 50, 50);
$pdf->setTextColor(255, 255, 255);
$pdf->cell(450, 20, 'Employee Details', 0, 1, 'C', true);
$pdf->setTextColor(0, 0, 0);
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'Employee Name', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getName(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'Qualification', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getQualification(), 0, 1, 'C', true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php';
$subject_id = new Subject($objPDO);
$subject_id->setID($record->getSubjectId());
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'Subject', 0, 0, 'C', true);
$pdf->cell(250, 20, $subject_id->getName(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'Date Of Birth', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getDateOfBirth(), 0, 1, 'C', true);
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'Gender', 0, 0, 'C', true);
$pdf->cell(250, 20, ucfirst($record->getGender()), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'Blood Group', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getBloodGroup(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, '', 0, 0, 'C', true);
$pdf->cell(250, 20, '', 0, 1, 'C', true);
$pdf->setFillColor(50, 50, 50);
$pdf->setTextColor(255, 255, 255);
$pdf->cell(450, 20, 'Contact Details', 0, 1, 'C', true);
$pdf->setTextColor(0, 0, 0);
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'Correspondence Address', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getCorrespondenceAddressLine1(), 0, 1, 'C', true);
$pdf->cell(200, 20, '', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getCorrespondenceAddressLine2(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'City', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getCorrespondenceCity(), 0, 1, 'C', true);
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'State', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getCorrespondenceState(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'Pincode', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getCorrespondencePincode(), 0, 1, 'C', true);
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'Phone', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getPhone(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'Mobile', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getMobile(), 0, 1, 'C', true);
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'Email', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getEmail(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(450, 20, '', 0, 1, 'C', true);
$pdf->setFillColor(50, 50, 50);
$pdf->setTextColor(255, 255, 255);
$pdf->cell(450, 20, 'Login Details', 0, 1, 'C', true);
$pdf->setTextColor(0, 0, 0);
$pdf->setFillColor(221, 221, 221);
$pdf->cell(200, 20, 'Employee Id *', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getTeacherId(), 0, 1, 'C', true);
$pdf->setFillColor(255, 255, 255);
$pdf->cell(200, 20, 'Temporary Password **', 0, 0, 'C', true);
$pdf->cell(250, 20, $record->getTempPass(), 0, 1, 'C', true);
/* TEMPLATE 1 DESIGN END*/
$pdf->SetFont('Arial', '', 10);
$pdf->SetXY($x + 100, 620);
$pdf->write(15, 'Employee\'s Signature');
$pdf->SetXY($x + 350, 620);
$pdf->write(15, 'Admin\'s Signature');
$pdf->SetFont('Arial', '', 8);
$pdf->SetXY($x + 20, 710);
$pdf->write(15, '* Employee Id may be Temporary , ** Please Change the Password for Security Reasons');
$pdf->SetXY($x + 20, 720);
$pdf->write(15, 'This is a Computer Generated Form. If any Discrepancy Contact Admin : eduCloud Reference Number ' . $user->getuserId());
// Close the document and save to the filesystem with the name simple.pdf
$pdf->Output('generated_files/enroll' . $record->getUserId() . '.pdf', 'F');
header('Location:http://localhost/cloud/generated_files/enroll' . $record->getUserId() . '.pdf');
}
示例13: viewVehicleBookingPDF
public function viewVehicleBookingPDF(Request $request)
{
$error = true;
$user = $request->session()->get('user');
if (is_null($user)) {
return redirect()->action('MainController@index');
} elseif ($user[0]->type == "tenant") {
if (isset($request['id'])) {
$bookingid = $request['id'];
$error = false;
} else {
$bookingid = false;
$error = true;
}
if ($error == false) {
$bookings = vehiclebookingModel::where('id', '=', $bookingid)->get();
$driver = $bookings[0]->vehicle->driver;
if ($driver = 0) {
$x = 'NO';
} else {
$x = 'Yes';
}
$vehicleName = $bookings[0]->vehicle->vehicleName;
$vehicleModel = $bookings[0]->vehicle->models;
$vehicleCat = $bookings[0]->vehicle->category->vehiclecatname;
$vehicleImage = $bookings[0]->vehicle->image;
include app_path() . '\\fpdf\\fpdf.php';
if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
$id = $_REQUEST['id'];
$pdf = new \FPDF();
$pdf->AddPage();
$pdf->Rect(5, 5, 200, 287, 'D');
//For A4
$pdf->SetFont("Arial", "B", 30);
$pdf->SetFillColor(36, 96, 84);
$pdf->write(6, $pdf->Image('images/logo.png', 145, 10, -100), 1, 1);
$pdf->SetFont("Arial", "B", 8);
$pdf->Ln(30);
$pdf->Cell(135);
$pdf->Write(10, "Phone: 2612205/57139151");
$pdf->Ln(10);
$pdf->Cell(135);
$pdf->Write(10, "Email: Lokeshpravin@gmail.com");
$pdf->SetFont("Arial", "B", 30);
$pdf->Write(10, "Welcome to Lodgiify");
$pdf->Ln(20);
$pdf->SetFont("Arial", "B", 12);
$pdf->Cell(20);
$pdf->MultiCell(25, 6, "Booking Form:", 'LRT', 'L', 0);
$pdf->Cell(20);
$pdf->Cell(75, 10, "Full Name :", 1, 0);
$pdf->Cell(75, 10, $user[0]->FirstName . ' ' . $user[0]->LastName, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "From :", 1, 0);
$pdf->Cell(75, 10, $bookings[0]->fromdate, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "To :", 1, 0);
$pdf->Cell(75, 10, $bookings[0]->todate, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "Price :", 1, 0);
$pdf->Cell(75, 10, 'Rs' . $bookings[0]->price, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "Vehicle Name :", 1, 0);
$pdf->Cell(75, 10, $vehicleName, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "Type :", 1, 0);
$pdf->Cell(75, 10, $vehicleCat, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "Model : ", 1, 0);
$pdf->Cell(75, 10, $vehicleModel, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "With driver : ", 1, 0);
$pdf->Cell(75, 10, $x, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 10, "Transmission : ", 1, 0);
$pdf->Cell(75, 10, $bookings[0]->vehicle->transmission, 1, 1);
$pdf->Cell(20);
$pdf->Cell(75, 60, "Image : ", 1, 0);
$pdf->Cell(75, 60, $pdf->Image('upload' . "/" . $vehicleImage, 118, 187, 50, 50), 1, 1);
$pdf->Ln(45);
$pdf->SetFont("Arial", "B", 10);
$pdf->Cell(155);
$pdf->Cell(0, 5, "Page " . $pdf->PageNo(), 0, 1);
$pdf->output();
die;
}
}
} else {
return response()->view('pages.404', ['user' => $user], 404);
}
}
示例14: FPDF
<?php
/*
php code to create pdf file using fpdf
download the fpdf lib from http://fpdf.org
*/
//import pdf
require 'fpdf/fpdf.php';
//instantiate the class
$pdf = new FPDF();
//** 1. setting files **/
//call first function to add page may be single page
$pdf->AddPage();
//set font for text
//syntax SetFont(font familly, style(ie; B,I,U) ,font size);
$pdf->SetFont("Arail", "B", "20");
//display content
// synctax Cell(width,height,content,border,boolean(0=append/1=new line),align);
$pdf->Cell(0, 20, "Hello...", 1, 1, "C");
//if you have multiple lines u can call write(height,content) instead of cell()
$pdf->write(5, "text something...");
//insert image
$pdf->Image("abc.jpg");
//
$pdf->SetXY(100, 100);
$pdf->Cell(0, 20, "Hello...", 1, 1, "C");
//call output function
$pdf->Output("123.pdf");
//parameter file name->123.pdf to write on disk, or left it blank if you want open file in browser.
示例15: download
public function download()
{
define('FPDF_FONTPATH', APPPATH . 'plugins/fpdf/font/');
require APPPATH . 'plugins/fpdf/fpdf.php';
$this->load->helper('url');
$getmed = $this->dbroom->getmedical();
$getlau = $this->dbroom->getlaundry();
$data['mednil'] = 0;
$data['launil'] = 0;
if ($getmed->num_rows() == 0) {
$data['mednil'] = 1;
}
if ($getlau->num_rows() == 0) {
$data['launil'] = 1;
}
$pdf = new FPDF('p', 'mm', 'a4');
$pdf->AddPage();
$pdf->setDisplayMode('fullpage');
$pdf->setFont('times', 'B', '20');
if (!$data['mednil']) {
$pdf->write(10, "\nStudents Asked for Medical Help\n\n");
$pdf->setFont('times', 'B', '15');
$pdf->cell(80, 10, "Name", 1, 0, 'C');
$pdf->cell(40, 10, "Room", 1, 0, 'C');
$pdf->cell(40, 10, "Phone", 1, 0, 'C');
$pdf->write(10, "\n");
foreach ($getmed->result() as $row) {
$pdf->setFont('times', '', '15');
$pdf->cell(80, 10, $row->name, 1, 0, 'C');
$pdf->cell(40, 10, $row->room, 1, 0, 'C');
$pdf->cell(40, 10, $row->phone, 1, 0, 'C');
$pdf->write(10, "\n");
// $pdf -> cell(200,30,$row->room,1,1);
// $pdf -> cell(200,30,$row->phone,1,1);
}
}
$pdf->setFont('times', 'B', '20');
if (!$data['launil']) {
$pdf->write(10, "\nStudents Asked for Laundry Service\n\n");
$pdf->setFont('times', 'B', '15');
$pdf->cell(80, 10, "Name", 1, 0, 'C');
$pdf->cell(40, 10, "Room", 1, 0, 'C');
$pdf->cell(40, 10, "Phone", 1, 0, 'C');
$pdf->write(10, "\n");
foreach ($getlau->result() as $row) {
$pdf->setFont('times', '', '15');
$pdf->cell(80, 10, $row->name, 1, 0, 'C');
$pdf->cell(40, 10, $row->room, 1, 0, 'C');
$pdf->cell(40, 10, $row->phone, 1, 0, 'C');
$pdf->write(10, "\n");
// $pdf -> cell(200,30,$row->room,1,1);
// $pdf -> cell(200,30,$row->phone,1,1);
}
}
$pdf->output('service.pdf', 'D');
}