本文整理匯總了PHP中FPDF::SetFontSize方法的典型用法代碼示例。如果您正苦於以下問題:PHP FPDF::SetFontSize方法的具體用法?PHP FPDF::SetFontSize怎麽用?PHP FPDF::SetFontSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FPDF
的用法示例。
在下文中一共展示了FPDF::SetFontSize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: PurchaseOrderModel
function export_order($id)
{
global $FANNIE_OP_DB, $FANNIE_ROOT;
$dbc = FannieDB::get($FANNIE_OP_DB);
$order = new PurchaseOrderModel($dbc);
$order->orderID($id);
$order->load();
$items = new PurchaseOrderItemsModel($dbc);
$items->orderID($id);
$vendor = new VendorsModel($dbc);
$vendor->vendorID($order->vendorID());
$vendor->load();
$contact = new VendorContactModel($dbc);
$contact->vendorID($order->vendorID());
$contact->load();
if (!class_exists('FPDF')) {
include_once $FANNIE_ROOT . 'src/fpdf/fpdf.php';
}
$pdf = new FPDF('P', 'mm', 'Letter');
$pdf->AddPage();
$pdf->SetFont('Arial', '', '12');
$pdf->Cell(100, 5, 'Vendor: ' . $vendor->vendorName(), 0, 0);
$pdf->Cell(100, 5, 'Date: ' . date('Y-m-d'), 0, 0);
$pdf->Ln();
$pdf->Cell(100, 5, 'Phone: ' . $contact->phone(), 0, 0);
$pdf->Cell(100, 5, 'Fax: ' . $contact->fax(), 0, 0);
$pdf->Ln();
$pdf->Cell(100, 5, 'Email: ' . $contact->email(), 0, 0);
$pdf->Cell(100, 5, 'Website: ' . $contact->website(), 0, 0);
$pdf->Ln();
$pdf->MultiCell(0, 5, "Ordering Info:\n" . $contact->notes(), 'B');
$pdf->Ln();
$cur_page = 0;
$pdf->SetFontSize(10);
foreach ($items->find() as $obj) {
if ($cur_page != $pdf->PageNo()) {
$cur_page = $pdf->PageNo();
$pdf->Cell(25, 5, 'SKU', 0, 0);
$pdf->Cell(20, 5, 'Order Qty', 0, 0);
$pdf->Cell(30, 5, 'Brand', 0, 0);
$pdf->Cell(65, 5, 'Description', 0, 0);
$pdf->Cell(20, 5, 'Case Size', 0, 0);
$pdf->Cell(20, 5, 'Est. Cost', 0, 0);
$pdf->Ln();
}
$pdf->Cell(25, 5, $obj->sku(), 0, 0);
$pdf->Cell(20, 5, $obj->quantity(), 0, 0, 'C');
$pdf->Cell(30, 5, $obj->brand(), 0, 0);
$pdf->Cell(65, 5, $obj->description(), 0, 0);
$pdf->Cell(20, 5, $obj->caseSize(), 0, 0, 'C');
$pdf->Cell(20, 5, sprintf('%.2f', $obj->caseSize() * $obj->unitCost() * $obj->quantity()), 0, 0);
$pdf->Ln();
}
$pdf->Output('order_export.pdf', 'D');
}
示例2: generate_attendees_PDF
public final function generate_attendees_PDF($tickets_list)
{
$this->load_pdf_libraries();
$pdf = new FPDF();
$ecp = TribeEvents::instance();
$pdf->AddFont('OpenSans', '', 'opensans.php');
$pdf->AddFont('SteelFish', '', 'steelfish.php');
$pdf->SetTitle('EventTicket');
$pdf->SetAuthor('The Events Calendar');
$pdf->SetCreator('The Events Calendar');
$defaults = array('event_id' => 0, 'ticket_name' => '', 'holder_name' => '', 'order_id' => '', 'ticket_id' => '', 'security_code' => '');
foreach ($tickets_list as $ticket) {
$ticket = wp_parse_args($ticket, $defaults);
$event = get_post($ticket['event_id']);
$venue_id = tribe_get_venue_id($event->ID);
$venue = !empty($venue_id) ? get_post($venue_id)->post_title : '';
$address = tribe_get_address($event->ID);
$zip = tribe_get_zip($event->ID);
$state = tribe_get_stateprovince($event->ID);
$city = tribe_get_city($event->ID);
$pdf->AddPage();
$pdf->SetDrawColor(28, 166, 205);
$pdf->SetFillColor(28, 166, 205);
$pdf->Rect(15, 10, 180, 34, 'F');
$pdf->SetTextColor(255);
$pdf->SetFont('OpenSans', '', 10);
$pdf->SetXY(30, 15);
$pdf->Write(5, __('EVENT NAME:', 'tribe-events-calendar'));
$pdf->SetXY(30, 28);
$pdf->SetFont('SteelFish', '', 53);
$title = strtoupper(utf8_decode($event->post_title));
$size = 53;
while ($pdf->GetStringWidth($title) > 151) {
$size--;
$pdf->SetFontSize($size);
}
$pdf->Write(5, $title);
$pdf->SetTextColor(41);
$pdf->SetFont('OpenSans', '', 10);
$pdf->SetXY(30, 50);
$pdf->Write(5, __('TICKET HOLDER:', 'tribe-events-calendar'));
$pdf->SetXY(104, 50);
$pdf->Write(5, __('LOCATION:', 'tribe-events-calendar'));
$pdf->SetFont('SteelFish', '', 30);
$pdf->SetXY(30, 59);
$holder = strtoupper(utf8_decode($ticket['holder_name']));
$size = 30;
while ($pdf->GetStringWidth($holder) > 70) {
$size--;
$pdf->SetFontSize($size);
}
$pdf->Write(5, $holder);
$pdf->SetXY(104, 59);
$venue = strtoupper(utf8_decode($venue));
$size = 30;
while ($pdf->GetStringWidth($venue) > 70) {
$size--;
$pdf->SetFontSize($size);
}
$pdf->Write(5, $venue);
$pdf->SetXY(104, 71);
$address = strtoupper(utf8_decode($address));
$size = 30;
while ($pdf->GetStringWidth($address) > 70) {
$size--;
$pdf->SetFontSize($size);
}
$pdf->Write(5, $address);
$pdf->SetXY(104, 83);
$address2 = array($city, $state, $zip);
$address2 = array_filter($address2);
$address2 = join(', ', $address2);
$address2 = strtoupper(utf8_decode($address2));
$size = 30;
while ($pdf->GetStringWidth($address2) > 70) {
$size--;
$pdf->SetFontSize($size);
}
$pdf->Write(5, $address2);
$pdf->Line(15, 97, 195, 97);
$pdf->SetFont('OpenSans', '', 10);
$pdf->SetXY(30, 105);
$pdf->Write(5, __('ORDER:', 'tribe-events-calendar'));
$pdf->SetXY(80, 105);
$pdf->Write(5, __('TICKET:', 'tribe-events-calendar'));
$pdf->SetXY(120, 105);
$pdf->Write(5, __('VERIFICATION:', 'tribe-events-calendar'));
$pdf->SetFont('SteelFish', '', 53);
$pdf->SetXY(30, 118);
$pdf->Write(5, $ticket['order_id']);
$pdf->SetXY(80, 118);
$pdf->Write(5, $ticket['ticket_id']);
$pdf->SetXY(120, 118);
$pdf->Write(5, $ticket['security_code']);
$pdf->Rect(15, 135, 180, 15, 'F');
$pdf->SetTextColor(255);
$pdf->SetFont('OpenSans', '', 10);
$pdf->SetXY(30, 140);
$pdf->Write(5, get_bloginfo('name'));
$pdf->SetXY(104, 140);
//.........這裏部分代碼省略.........
示例3: drawPDF
public function drawPDF()
{
$pdf = new \FPDF('L', 'mm', 'Letter');
$pdf->SetMargins(3.175, 3.175, 3.175);
$pdf->SetAutoPageBreak(false);
if (\COREPOS\Fannie\API\FanniePlugin::isEnabled('CoopDealsSigns')) {
$this->font = 'Gill';
$this->alt_font = 'GillBook';
define('FPDF_FONTPATH', dirname(__FILE__) . '/../../../modules/plugins2.0/CoopDealsSigns/noauto/fonts/');
$pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
}
$pdf->SetFont($this->font, '', 16);
$data = $this->loadItems();
$width = 136.52;
$height = 105;
$top = 90;
$left = 15;
$effective_width = $width - 2 * $left;
foreach ($data as $item) {
$pdf->AddPage();
$column = 1;
// right aligned
$price = $this->printablePrice($item);
$pdf->SetXY($left + $width * $column, $top);
$pdf->SetFontSize($this->SMALL_FONT);
$pdf->Cell($effective_width, 10, $item['brand'], 0, 1, 'C');
$pdf->SetX($left + $width * $column);
$pdf->SetFontSize($this->MED_FONT);
$pdf->MultiCell($effective_width, 12, $item['description'], 0, 'C');
$pdf->SetX($left + $width * $column);
$pdf->SetFontSize($this->BIG_FONT);
$pdf->Cell($effective_width, 25, $price, 0, 1, 'C');
$y_pos = $pdf->GetY();
if ($item['startDate'] != '' && $item['endDate'] != '') {
// intl would be nice
$datestr = $this->getDateString($item['startDate'], $item['endDate']);
$pdf->SetXY($left + $width * $column, $top + ($height - 40));
$pdf->SetFontSize($this->SMALL_FONT);
$pdf->Cell($effective_width, 20, $datestr, 0, 1, 'R');
}
if ($item['originName'] != '') {
$pdf->SetXY($left + $width * $column, $y_pos);
$pdf->SetFontSize($this->SMALL_FONT);
if (strlen($item['originName']) < 50) {
$pdf->Cell($effective_width, 20, $item['originName'], 0, 1, 'L');
} else {
$pdf->Cell($effective_width, 20, $item['originShortName'], 0, 1, 'L');
}
}
}
$pdf->Output('WfcProdSingle.pdf', 'I');
}
示例4: drawPDF
public function drawPDF()
{
$pdf = new \FPDF('P', 'mm', 'Letter');
$pdf->SetMargins(0, 3.175, 0);
$pdf->SetAutoPageBreak(false);
define('FPDF_FONTPATH', dirname(__FILE__) . '/noauto/fonts/');
$pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
$pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php');
$pdf->AddFont('GillBook', '', 'GillSansMTPro-Book.php');
$pdf->SetFont('Gill', '', 16);
$data = $this->loadItems();
$count = 0;
$sign = 0;
$width = 53.975;
$height = 68.95999999999999;
$top = 20;
$left = 5.175;
$effective_width = $width - 2 * $left;
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetLineWidth(0.2);
foreach ($data as $item) {
if ($count % 16 == 0) {
$pdf->AddPage();
// draw tick marks for cutting
$pdf->Line(2, $height + 1.5, 6, $height + 1.5);
$pdf->Line(2, 2 * $height + 1.5, 6, 2 * $height + 1.5);
$pdf->Line(2, 3 * $height + 1.5, 6, 3 * $height + 1.5);
$pdf->Line($width, 2, $width, 6);
$pdf->Line(2 * $width, 2, 2 * $width, 6);
$pdf->Line(3 * $width, 2, 3 * $width, 6);
$pdf->Line($width, 4 * $height - 4, $width, 4 * $height);
$pdf->Line(2 * $width, 4 * $height - 4, 2 * $width, 4 * $height);
$pdf->Line(3 * $width, 4 * $height - 4, 3 * $width, 4 * $height);
$pdf->Line(4 * $width - 6, $height + 1.5, 4 * $width - 2, $height + 1.5);
$pdf->Line(4 * $width - 6, 2 * $height + 1.5, 4 * $width - 2, 2 * $height + 1.5);
$pdf->Line(4 * $width - 6, 3 * $height + 1.5, 4 * $width - 2, 3 * $height + 1.5);
$sign = 0;
}
$row = floor($sign / 4);
$column = $sign % 4;
$price = $item['normal_price'];
if ($item['scale']) {
if (substr($price, 0, 1) != '$') {
$price = sprintf('$%.2f', $price);
}
$price .= ' /lb.';
} elseif (isset($item['signMultiplier'])) {
$price = $this->formatPrice($item['normal_price'], $item['signMultiplier']);
} else {
$price = $this->formatPrice($item['normal_price']);
}
$pdf->Image(dirname(__FILE__) . '/cd_head_16.png', $left - 2 + $width * $column, $top - 17 + $row * $height, $width - 6);
$pdf->SetXY($left + $width * $column, $top + $row * $height - 2);
$pdf->SetFont('Gill', 'B', $this->SMALL_FONT);
$font_shrink = 0;
while (true) {
$pdf->SetX($left + $width * $column);
$y = $pdf->GetY();
$pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C');
if ($pdf->GetY() - $y > 6) {
$pdf->SetFillColor(0xff, 0xff, 0xff);
$pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
$font_shrink++;
if ($font_shrink >= $this->SMALL_FONT) {
break;
}
$pdf->SetFontSize($this->MED_FONT - $font_shrink);
$pdf->SetXY($left + $width * $column, $y);
} else {
break;
}
}
$pdf->SetX($left + $width * $column);
$pdf->SetFont('Gill', '', $this->MED_FONT);
$font_shrink = 0;
while (true) {
$pdf->SetX($left + $width * $column);
$y = $pdf->GetY();
$pdf->MultiCell($effective_width, 6, $item['description'], 0, 'C');
if ($pdf->GetY() - $y > 12) {
$pdf->SetFillColor(0xff, 0xff, 0xff);
$pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
$font_shrink++;
if ($font_shrink >= $this->MED_FONT) {
break;
}
$pdf->SetFontSize($this->MED_FONT - $font_shrink);
$pdf->SetXY($left + $width * $column, $y);
} else {
if ($pdf->GetY() - $y < 12) {
$words = explode(' ', $item['description']);
$multi = '';
for ($i = 0; $i < floor(count($words) / 2); $i++) {
$multi .= $words[$i] . ' ';
}
$multi = trim($multi) . "\n";
for ($i = floor(count($words) / 2); $i < count($words); $i++) {
$multi .= $words[$i] . ' ';
}
$item['description'] = trim($multi);
//.........這裏部分代碼省略.........
示例5: pdf
function pdf()
{
$this->load->library('cfpdf');
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 'L');
$pdf->SetFontSize(14);
$pdf->Text(10, 10, 'LAPORAN TRANSAKSI');
$pdf->SetFont('Arial', 'B', 'L');
$pdf->SetFontSize(10);
$pdf->Cell(10, 10, '', '', 1);
$pdf->Cell(10, 7, 'No', 1, 0);
$pdf->Cell(27, 7, 'Tanggal', 1, 0);
$pdf->Cell(30, 7, 'Operator', 1, 0);
$pdf->Cell(38, 7, 'Total Transaksi', 1, 1);
// tampilkan dari database
$pdf->SetFont('Arial', '', 'L');
$data = $this->model_transaksi->laporan_default();
$no = 1;
$total = 0;
foreach ($data->result() as $r) {
$pdf->Cell(10, 7, $no, 1, 0);
$pdf->Cell(27, 7, $r->tanggal_transaksi, 1, 0);
$pdf->Cell(30, 7, $r->nama_lengkap, 1, 0);
$pdf->Cell(38, 7, $r->total, 1, 1);
$no++;
$total = $total + $r->total;
}
// end
$pdf->Cell(67, 7, 'Total', 1, 0, 'R');
$pdf->Cell(38, 7, $total, 1, 0);
$pdf->Output();
}
示例6: otr_pdf_writer
public function otr_pdf_writer($file, $info)
{
$path = getcwd();
if (!is_dir($path . '/img/')) {
if (mkdir($path . '/img')) {
if (!mkdir($path . '/img/otr_pdfs')) {
return false;
}
} else {
return false;
}
} elseif (!is_dir($path . '/img/otr_pdfs/')) {
if (!mkdir($path . '/img/otr_pdfs')) {
return false;
}
}
$url_file_path = '/img/otr_pdfs/' . $file;
$filename = $path . $url_file_path;
$info['student_full_name'] = $info['FirstName'] . ' ' . $info['MiddleName'] . ' ' . $info['LastName'];
$pdf = new FPDF('P', 'mm', array(218, 290));
$pdf->SetAuthor($info['student_full_name']);
$pdf->SetTitle('OTR');
$pdf->SetFont('Helvetica', 'B', 20);
$pdf->SetTextColor(50, 60, 100);
$pdf->AddPage('P');
//$pdf->SetDisplayMode('real','default');
$pdf->SetFontSize(10);
// Background image
$pdf->Image('../resources/otr/otr_multi_form2.png', 0, 0);
$start_x = 18;
$start_y = 46;
for ($i = 0; $i < 3; $i++) {
// Fill out first form
// Name
$pdf->SetFont('Times', 'B', 14);
$start_address_Y = $start_y - 27;
foreach ($info['otr_address'] as $otr_address) {
$pdf->SetXY($start_x + 109, $start_address_Y);
$pdf->Write(5, $otr_address);
$start_address_Y += 5;
}
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->SetXY($start_x, $start_y);
$pdf->Write(5, $info['student_full_name']);
// Address
$pdf->SetXY($start_x + 2, $start_y + 6.5);
$pdf->Write(5, $info['addr_line1_CA']);
// Years of Attendance (I don't believe we are gathering this information)
//$pdf->SetXY($start_x+90,$start_y+6.5);
//$pdf->Write(5,$info['name']);
//$pdf->SetXY($start_x+115,$start_y+6.5);
//$pdf->Write(5,$info['name']);
// City, State
$pdf->SetXY($start_x + 1, $start_y + 13);
$pdf->Write(5, $info['city_CA'] . ', ' . $info['st_ca']);
// Zip Code
$pdf->SetXY($start_x + 58, $start_y + 13);
$pdf->Write(5, $info['zip_CA']);
// Soc. Security Number
// $pdf->SetXY($start_x+26,$start_y+19.5);
// $pdf->Write(5,$info['SF_NO']);
// Phone Number & Email
$pdf->SetXY($start_x + 15, $start_y + 26);
if ($info['pref_contact'] == 'cell_phone') {
$pdf->Write(5, $info['ndcellphone']);
} else {
$pdf->Write(5, $info['phone']);
}
$pdf->SetFontSize(8);
$pdf->SetXY($start_x + 52, $start_y + 26);
$pdf->Write(5, $info['line1']);
$pdf->SetFontSize(10);
// Birth Date
$birth_date = explode('/', $info['birth_date']);
$pdf->SetXY($start_x + 115, $start_y + 26);
$pdf->Write(5, $birth_date[0]);
$pdf->SetXY($start_x + 122.5, $start_y + 26);
$pdf->Write(5, $birth_date[1]);
$pdf->SetXY($start_x + 130, $start_y + 26);
$pdf->Write(5, $birth_date[2]);
// Today's Date
$pdf->SetXY($start_x + 102, $start_y + 32.5);
$pdf->Write(5, date('m'));
$pdf->SetXY($start_x + 109.5, $start_y + 32.5);
$pdf->Write(5, date('d'));
$pdf->SetXY($start_x + 117, $start_y + 32.5);
$pdf->Write(5, date('Y'));
// Move to the next form:
$start_y = $start_y + 93;
}
$pdf->Output($filename);
if (file_exists($filename)) {
//$full_url = 'http://'.$_SERVER['HTTP_HOST'].$url_file_path;
return $url_file_path;
} else {
return false;
}
}
示例7: exportPdf
function exportPdf()
{
$db = JFactory::getDBO();
while (ob_get_level()) {
ob_end_clean();
}
header("Content-Encoding: None", true);
require JPATH_COMPONENT . DS . 'helpers' . DS . 'fpdf.php';
include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'font' . DS . 'helvetica.php';
$quiz_id = intval(JRequest::getVar("id", ""));
//create a FPDF object
$pdf = new FPDF();
//set font for the entire document
$pdf->SetFont('Arial', 'B', 20);
$pdf->SetTextColor(50, 60, 100);
//set up a page
$pdf->AddPage();
@$pdf->SetDisplayMode(real, 'default');
$pdf->SetXY(10, 5);
$pdf->SetFontSize(8);
$z = 25;
$t = $z + 10;
$pdf->SetXY(10, $t);
$pdf->SetFontSize(7);
$pdf->Cell(25, 10, JText::_("GURU_NAME"), 'LRTB', '', 'L', 0);
$pdf->Cell(39, 10, JText::_("GURU_EMAIL"), 'LRTB', '', 'L', 0);
$pdf->Cell(100, 10, JText::_("GURU_PROGRAM"), 'LRTB', '', 'L', 0);
$pdf->Ln();
$pid = JRequest::getVar("course", 0);
$result = array();
$user = JFactory::getUser();
$sql = "select `id` from #__guru_program where `author` like '%|" . intval($user->id) . "|%' OR `author`='" . intval($user->id) . "'";
$db->setQuery($sql);
$db->query();
$courses_ids = $db->loadColumn();
$sql = "select `id`, `name` from #__guru_program where `author` like '%|" . intval($user->id) . "|%' OR `author`='" . intval($user->id) . "'";
$db->setQuery($sql);
$db->query();
$courses_names = $db->loadAssocList("id");
if (!isset($courses_ids) || count($courses_ids) <= 0) {
$courses_ids = array("0" => "0");
}
if (intval($pid) != 0) {
$courses_ids = array(intval($pid));
}
$sql = "select distinct(`userid`) from #__guru_buy_courses where `course_id` in (" . implode(",", $courses_ids) . ")";
$db->setQuery($sql);
$db->query();
$students_ids = $db->loadColumn();
if (isset($students_ids) && count($students_ids) > 0) {
$sql = "select distinct(c.`userid`), A.`courses`, u.* from #__guru_buy_courses c, (select `userid`, GROUP_CONCAT(`course_id` SEPARATOR '-') as courses from #__guru_buy_courses where `course_id` in (" . implode(",", $courses_ids) . ") group by `userid`) as A, #__users u, #__guru_customer cust where `course_id` in (" . implode(",", $courses_ids) . ") and c.`userid`=A.`userid` and u.`id`=c.`userid` and cust.`id`=u.`id`";
$db->setQuery($sql);
$db->query();
$result = $db->loadAssocList();
}
$new_id = 0;
$nr = 1;
for ($i = 0; $i < count($result); $i++) {
$name = $result[$i]["name"];
$email = $result[$i]["email"];
$courses = $result[$i]["courses"];
$student_courses = array();
$courses = explode("-", $courses);
if (isset($courses) && count($courses) > 0) {
foreach ($courses as $key => $value) {
$student_courses[] = $courses_names[$value]["name"];
}
}
$pdf->SetFontSize(7);
$pdf->Cell(25, 10, $name, 'LRTB', '', 'L', 0);
$pdf->Cell(39, 10, $email, 'LRTB', '', 'L', 0);
$pdf->Cell(100, 10, implode(", ", $student_courses), 'LRTB', '', 'L', 0);
$pdf->Ln();
}
//Output the document
$pdf->Output('ExportResult.pdf', 'I');
}
示例8: otr_pdf_writer
public function otr_pdf_writer($file, $info)
{
// Generate Filename based on Person's & Timestamp
$path = getcwd();
if (!is_dir($path . '/img/')) {
if (mkdir($path . '/img')) {
if (!mkdir($path . '/img/otr_pdfs')) {
return false;
}
} else {
return false;
}
} elseif (!is_dir($path . '/img/otr_pdfs/')) {
if (!mkdir($path . '/img/otr_pdfs')) {
return false;
}
}
$url_file_path = '/img/otr_pdfs/' . $file;
$filename = $path . $url_file_path;
$info['student_full_name'] = $info['first_name'] . ' ' . $info['middle_name'] . ' ' . $info['last_name'];
$pdf = new FPDF('P', 'mm', array(218, 290));
$pdf->SetAuthor($info['student_full_name']);
$pdf->SetTitle('OTR');
$pdf->SetFont('Helvetica', 'B', 20);
$pdf->SetTextColor(50, 60, 100);
$pdf->AddPage('P');
$pdf->SetFontSize(10);
// Background image
$pdf->Image('img/otr_multi_form2.png', 0, 0);
$start_x = 18;
$start_y = 46;
for ($i = 0; $i < 3; $i++) {
// Fill out first form
// Name
$pdf->SetFont('Times', 'B', 14);
$start_address_Y = $start_y - 27;
foreach ($info['otr_address'] as $otr_address) {
$pdf->SetXY($start_x + 109, $start_address_Y);
$pdf->Write(5, $otr_address);
$start_address_Y += 5;
}
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->SetXY($start_x, $start_y);
$pdf->Write(5, $info['student_full_name']);
// Address
$pdf->SetXY($start_x + 2, $start_y + 6.5);
$pdf->Write(5, $info['address1']);
// City, State
$pdf->SetXY($start_x + 1, $start_y + 13);
$pdf->Write(5, $info['city'] . ', ' . $info['state']);
// Zip Code
$pdf->SetXY($start_x + 58, $start_y + 13);
$pdf->Write(5, $info['zip_code']);
// Phone Number & Email
$pdf->SetXY($start_x + 15, $start_y + 26);
$pdf->Write(5, $info['home_phone']);
$pdf->SetFontSize(8);
$pdf->SetXY($start_x + 52, $start_y + 26);
$pdf->Write(5, $info['email']);
$pdf->SetFontSize(10);
// Birth Date
$birth_date = explode('-', $info['dob']);
$pdf->SetXY($start_x + 115, $start_y + 26);
$pdf->Write(5, $birth_date[0]);
$pdf->SetXY($start_x + 122.5, $start_y + 26);
$pdf->Write(5, $birth_date[1]);
$pdf->SetXY($start_x + 130, $start_y + 26);
$pdf->Write(5, $birth_date[2]);
// Today's Date
$pdf->SetXY($start_x + 102, $start_y + 32.5);
$pdf->Write(5, date('m'));
$pdf->SetXY($start_x + 109.5, $start_y + 32.5);
$pdf->Write(5, date('d'));
$pdf->SetXY($start_x + 117, $start_y + 32.5);
$pdf->Write(5, date('Y'));
// Move to the next form:
$start_y = $start_y + 93;
}
$pdf->Output($filename);
if (file_exists($filename)) {
return $url_file_path;
} else {
return false;
}
}
示例9: drawPDF
public function drawPDF()
{
$pdf = new \FPDF('L', 'mm', 'Letter');
$pdf->SetMargins(3.175, 3.175, 3.175);
$pdf->SetAutoPageBreak(false);
define('FPDF_FONTPATH', dirname(__FILE__) . '/noauto/fonts/');
$pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
$pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php');
$pdf->AddFont('GillBook', '', 'GillSansMTPro-Book.php');
$pdf->SetFont('Gill', '', 16);
$data = $this->loadItems();
$count = 0;
$sign = 0;
$width = 68.67;
$height = 71;
$top = 22;
$left = 6.0;
$effective_width = $width - $left;
foreach ($data as $item) {
if ($count % 12 == 0) {
if ($count != 0) {
// draw tick marks again
// sometimes other content of the page
// overwrites them
$pdf->Line(2, $height + 0.0, 6, $height + 0.0);
$pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0);
$pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0);
$pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0);
$pdf->Line($width + 1.5, 2, $width + 1.5, 8);
$pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8);
$pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8);
$pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height);
$pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height);
$pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height);
}
$pdf->AddPage();
// draw tick marks for cutting
$pdf->Line(2, $height + 0.0, 6, $height + 0.0);
$pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0);
$pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0);
$pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0);
$pdf->Line($width + 1.5, 2, $width + 1.5, 8);
$pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8);
$pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8);
$pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height);
$pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height);
$pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height);
$sign = 0;
}
$row = floor($sign / 4);
$column = $sign % 4;
$price = $item['normal_price'];
if ($item['scale']) {
if (substr($price, 0, 1) != '$') {
$price = sprintf('$%.2f', $price);
}
$price .= ' /lb.';
} elseif (isset($item['signMultiplier'])) {
$price = $this->formatPrice($item['normal_price'], $item['signMultiplier']);
} else {
$price = $this->formatPrice($item['normal_price']);
}
$pdf->Image(dirname(__FILE__) . '/cd_head_16.png', $left - 1 + $width * $column, $top - 19 + $row * $height, $width - 6);
$pdf->SetXY($left + $width * $column, $top + $row * $height + 1);
$pdf->SetFont('Gill', 'B', $this->SMALL_FONT);
$pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C');
/**
This block attempts to write the description then
checks how many lines it took. If the description was
longer than two lines, it whites the whole thing out,
drops one font size, and tries again. Calculating
effective text size with smart line breaks seems
really tough.
*/
$pdf->SetFont('Gill', '', $this->MED_FONT);
$font_shrink = 0;
while (true) {
$pdf->SetX($left + $width * $column);
$y = $pdf->GetY();
$pdf->MultiCell($effective_width, 7, $item['description'], 0, 'C');
if ($pdf->GetY() - $y > 14) {
$pdf->SetFillColor(0xff, 0xff, 0xff);
$pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
$font_shrink++;
if ($font_shrink >= $this->MED_FONT) {
break;
}
$pdf->SetFontSize($this->MED_FONT - $font_shrink);
$pdf->SetXY($left + $width * $column, $y);
} else {
if ($pdf->GetY() - $y < 14) {
$words = explode(' ', $item['description']);
$multi = '';
for ($i = 0; $i < floor(count($words) / 2); $i++) {
$multi .= $words[$i] . ' ';
}
$multi = trim($multi) . "\n";
for ($i = floor(count($words) / 2); $i < count($words); $i++) {
$multi .= $words[$i] . ' ';
}
//.........這裏部分代碼省略.........
示例10: exportFilePdf
function exportFilePdf()
{
while (ob_get_level()) {
ob_end_clean();
}
header("Content-Encoding: None", true);
require JPATH_COMPONENT . DS . 'helpers' . DS . 'fpdf.php';
include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'font' . DS . 'helvetica.php';
$quiz_id = intval(JRequest::getVar("id", ""));
//create a FPDF object
$pdf = new FPDF();
//set font for the entire document
$pdf->SetFont('Arial', 'B', 20);
$pdf->SetTextColor(50, 60, 100);
//set up a page
$pdf->AddPage();
$pdf->SetDisplayMode(real, 'default');
$pdf->SetXY(10, 5);
$pdf->SetFontSize(8);
$db = JFactory::getDBO();
$sql = "select name from #__guru_quiz where id=" . $quiz_id;
$db->setQuery($sql);
$name = $db->loadColumn();
$name = $name["0"];
$pdf->Write(5, 'Student Quiz Result for ' . "'" . $name . "'");
$pdf->SetXY(10, 15);
$pdf->SetFontSize(8);
$pdf->Cell(20, 10, 'Times', 1, 0, 'C', 0);
$pdf->Cell(20, 10, 'Students', 1, 0, 'C', 0);
$pdf->Cell(20, 10, 'Avg Score', 1, 0, 'C', 0);
//display the title with a border around it
$res = guruAdminModelguruQuiz::NbOfTimesandStudents($quiz_id);
$z = 25;
$scoresByUserId = array();
$maxNoOfTimes = 0;
for ($i = 0; $i < count($res); $i++) {
$newElem = new stdClass();
$newElem->user_id = $res[$i]["user_id"];
$newElem->scores = explode(",", $res[$i]["score_by_user"]);
if (count($newElem->scores) > $maxNoOfTimes) {
$maxNoOfTimes = count($newElem->scores);
}
array_push($scoresByUserId, $newElem);
}
$newvect = array();
for ($i = 0; $i < $maxNoOfTimes; $i++) {
$newElem = new stdClass();
$newElem->noOfTimes = $i + 1;
$newElem->noOfStudents = 0;
$newElem->sumScores = 0;
for ($j = 0; $j < count($scoresByUserId); $j++) {
if (count($scoresByUserId[$j]->scores) >= $i + 1) {
$newElem->noOfStudents += 1;
$newElem->sumScores += $scoresByUserId[$j]->scores[$i];
}
}
$newElem->avgScore = $newElem->sumScores / $newElem->noOfStudents;
array_push($newvect, $newElem);
}
for ($i = 0; $i < count($newvect); $i++) {
if ($i + 1 == 1) {
$nboftimes = $i + 1 . "st";
} elseif ($i + 1 == 2) {
$nboftimes = $i + 1 . "nd";
} elseif ($i + 1 == 3) {
$nboftimes = $i + 1 . "rd";
} elseif ($i + 1 > 3) {
$nboftimes = $i + 1 . "th";
}
$studtot = $newvect[$i]->noOfStudents;
$avg = intval($newvect[$i]->avgScore * 100);
$pdf->SetXY(10, $z);
$pdf->SetFontSize(7);
$pdf->Cell(20, 10, $nboftimes, 1, 0, 'C', 0);
$pdf->Cell(20, 10, $studtot, 1, 0, 'C', 0);
$pdf->Cell(20, 10, $avg, 1, 0, 'C', 0);
$z += 10;
}
$t = $z + 10;
$pdf->SetXY(10, $t);
$pdf->SetFontSize(7);
$pdf->Cell(25, 10, 'First Name', 'LRTB', '', 'L', 0);
$pdf->Cell(25, 10, 'Last Name', 'LRTB', '', 'L', 0);
$pdf->Cell(39, 10, 'Email', 'LRTB', '', 'L', 0);
$pdf->Cell(15, 10, '#', 'LRTB', '', 'L', 0);
$pdf->Cell(20, 10, 'Username', 'LRTB', '', 'L', 0);
$pdf->Cell(20, 10, 'Date Taken', 'LRTB', '', 'L', 0);
$pdf->Cell(20, 10, 'Score', 'LRTB', '', 'L', 0);
$pdf->Ln();
//-----------------------------------------
$pid = JRequest::getVar("pid", 0, 'post', 'int');
$db = JFactory::getDBO();
$sql = "select u.id, u.username, u.email, c.firstname, c.lastname, tq.date_taken_quiz, tq.score_quiz, tq.`id` as tq_id from #__guru_customer c, #__users u, #__guru_quiz_taken tq where c.id=u.id and c.id = tq.user_id and u.id IN (select user_id from #__guru_quiz_taken where quiz_id=" . $quiz_id . ") and tq.quiz_id=" . $quiz_id . " order by c.id desc";
$db->setQuery($sql);
$tmp = $db->loadObjectList();
$new_id = 0;
$nr = 1;
for ($i = 0; $i < count($tmp); $i++) {
$firstname = $tmp[$i]->firstname;
$lastname = $tmp[$i]->lastname;
//.........這裏部分代碼省略.........
示例11: date
require 'fpdf.php';
session_start();
$total = 0;
$date = date("d/m/Y");
$address = isset($_SESSION['address']) ? $_SESSION['address'] : '';
$mail = isset($_SESSION['email']) ? $_SESSION['email'] : '';
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Courier', 'b', 30);
$pdf->SetTextColor(254, 152, 15);
//can put empty quotes, bold, underline, italics,
$pdf->Image('./images/home/logo.png', 90, 5, 30);
$pdf->Ln();
$pdf->Cell(80, 20, 'RECEIPT');
$pdf->Ln();
$pdf->SetFontSize(14);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(80, 20, 'Trendy-Gear');
$pdf->Ln();
$pdf->SetTextColor(254, 152, 15);
$pdf->Cell(80, 20, 'BILL TO');
$pdf->Cell(100, 20, 'RECEIPT DATE');
$pdf->Ln();
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFontSize(12);
$pdf->Cell(80, 1, $mail);
$pdf->Ln();
$pdf->Cell(80, 10, $address);
$pdf->Cell(100, 1, $date);
$pdf->Ln(10);
$pdf->Cell(80, 5, 'Item', 1, 0, 'C', 0);
示例12: SetFontSize
function SetFontSize($size)
{
// not sure why, but seems that UTF fonts are bigger than latin1 fonts
// so analyze and reduce size when required
switch (strtolower($this->FontFamily)) {
// fpdf stores font family in lowercase
case "dejavu":
if ($size > 1) {
$size -= 0.5;
}
// no break;
// no break;
case "free":
if ($size > 0) {
$size -= 0.5;
}
break;
}
parent::SetFontSize($size);
}
示例13: FPDF
}
$pdf = new FPDF();
//set document properties
$pdf->SetAuthor('Alexandr Slovinskiy');
$pdf->SetTitle('Order Annex');
//set font for the entire document
$pdf->AddFont('Times', '', 'times.php');
$pdf->SetFont('Times', '');
$pdf->SetTextColor(0, 0, 0);
//set up a page
$pdf->AddPage('L');
$pdf->SetDisplayMode(real, 'default');
//display the title with a border around it
//Set x and y position for the main text, reduce font size and write content
$pdf->Image('img/form_1-12-2.jpg', 10, 15, 280);
$pdf->SetFontSize(9);
$pdf->SetXY(261, 29.5);
$pdf->Write(5, $_POST["order_number"]);
$pdf->SetXY(197.5, 37);
$pdf->Write(5, $_POST["day"]);
$pdf->SetXY(205, 37);
$pdf->Write(5, $_POST["month"]);
$pdf->SetXY(225.4, 37);
$pdf->Write(5, substr($_POST["year"], 2, 2));
$pdf->SetXY(196, 63);
if ($_POST["search_finance"] == 'b') {
$pdf->Write(5, "за державним замовленням");
}
if ($_POST["search_finance"] == 'c') {
$pdf->Write(5, "за рахунок коштів фізичних, юридичних осіб");
}
示例14:
//*************************
//** Images **
$imgScaleBorder = 97;
$imgScaleWatermark = 75;
$imgSpacingBorder = 1.5;
$pdf->Image('resources/certificates/border_L.png', $xMarginLeft + $imgSpacingBorder, $yMarginTop + $imgSpacingBorder, $imgScaleBorder);
$pdf->Image('resources/certificates/watermark_light.png', ($wTextArea - $imgScaleWatermark) / 2 + $xLeftTextMargin, $yMarginTop + 7, $imgScaleWatermark);
$pdf->Image('resources/certificates/border_R.png', $xMarginRight - $imgSpacingBorder - $imgScaleBorder, $yMarginBottom - $imgSpacingBorder - $imgScaleBorder, $imgScaleBorder);
//** Title **
$yLine = $yMarginTop + 16;
$pdf->SetFont('Porcelain', '', 42);
$pdf->SetY($yLine);
$pdf->Cell(0, 10, $textTitle, 0, 1, 'C');
//** Body Lines **
$pdf->SetFont('DemiTasse');
$pdf->SetFontSize(14);
$pdf->SetDrawColor(0, 0, 0);
//** Line 1: Gifts **
$yLine = $yLine + 22;
$wStatic = $pdf->GetStringWidth($textGiftStatic);
// $wDynamic = $pdf->GetStringWidth($textGiftDynamic);
$wAvailForDynaimc = $wTextArea - $wStatic - 2 * $wSpace;
//Case 1: Fits on one line
$wDynamic = $pdf->GetStringWidth($textGiftDynamic);
if ($wDynamic <= $wAvailForDynaimc) {
// $pdf->SetXY(10,10);
// $pdf->Cell(20,0, "DEBUG: case 1");
$wSideSpacing = ($wTextArea - $wStatic - $wDynamic - 2 * $wSpace) / 2;
$xStatic = $xLeftTextMargin + $wSideSpacing;
$pdf->SetXY($xStatic, $yLine);
$pdf->Cell($wStatic, 10, $textGiftStatic, 0, 0, 'L');
示例15: GeneratePresentation
function GeneratePresentation($realty_id)
{
global $app_list_strings;
$pdf = new FPDF();
$pdf->AddFont('TimesNewRomanPSMT', '', 'times.php');
$pdf->AddFont('Times-Italic', 'I', 'timesi.php');
$pdf->SetAuthor('OfficeWorld');
$pdf->SetTitle('Presentation');
$pdf->SetFont('TimesNewRomanPSMT', '', 25);
$pdf->SetTextColor(100, 100, 100);
$pdf->AddPage('L');
$pdf->SetDisplayMode('real', 'default');
$realty = new Realty();
$realty->retrieve($realty_id);
$image_main = '';
$image_map = array();
$image_plan = array();
$images = array();
$address = array();
$currency = $realty->currency == 'RUR' ? 'рублей' : 'долларов';
$operation_text = $app_list_strings['operation_realty_list'][$realty->operation];
/*if($realty->address_country!='') $address[]=$realty->address_country;
if($realty->address_region!='') $address[]=$realty->address_region;
if($realty->address_city!='') $address[]=$realty->address_city;*/
if ($realty->metro != '') {
$address[] = $realty->metro;
}
if ($realty->address_street != '') {
$address[] = $realty->address_street;
}
if ($realty->address_house != '') {
$address[] = $realty->address_house;
}
if ($realty->address_apartment != '') {
$address[] = "кв." . $realty->address_apartment;
}
$address = implode(', ', $address);
if (is_dir('upload/gallery_images/' . $realty->id)) {
$db_img = DBManagerFactory::getInstance();
$sql_img = "SELECT galleria_c FROM realty_cstm WHERE id_c = '" . $realty->id . "'";
$result_img = $db_img->query($sql_img);
$row_img = $db_img->fetchByAssoc($result_img);
$img_str = $row_img['galleria_c'];
$image = explode('|', $img_str);
foreach ($image as $key => $value) {
$value = str_replace('^,^', '|', $value);
$value = str_replace('^', '', $value);
$image_t = explode('|', $value);
if ($image_t[2] == 'main') {
$image_main = $image_t[1];
} elseif ($image_t[8] == 'on') {
$image_map = $image_t;
} elseif ($image_t[9] == 'on') {
$image_plan = $image_t;
} elseif ($image_t[7] == 'on') {
$images[] = $image_t;
}
}
}
$pdf->SetXY(0, 5);
$text = decode("{$operation_text}\n{$address}");
$pdf->MultiCell(297, 7, $text, 0, 'C');
$y = $pdf->GetY() + 5;
if ($image_main != '') {
$img = "upload/gallery_images/{$realty->id}/{$image_main}";
list($w_i, $h_i) = getimagesize($img);
if ($w_i - $h_i > $w_i * 0.3) {
$y += (184 - $y - $h_i * 284 / $w_i) / 2;
$pdf->Image($img, 6, 15 + $y, 284, 0);
} else {
$x = (284 - $w_i * (184 - $y) / $h_i) / 2;
$pdf->Image($img, 6 + $x, $y, 0, 184 - $y);
}
}
//Footer
$pdf->Image('custom/Presentation/footer_main.png', 0, 172, 297, 0);
//Page2
$pdf->SetTextColor(255, 255, 255);
if (isset($image_map[1])) {
$pdf->AddPage('L');
$img = "upload/gallery_images/{$realty->id}/{$image_map[1]}";
list($w_i, $h_i) = getimagesize($img);
if ($w_i - $h_i > $w_i * 0.3) {
$y = (178 - $h_i * 284 / $w_i) / 2;
$pdf->Image($img, 6, 15 + $y, 284, 0);
} else {
$x = (284 - $w_i * 178 / $h_i) / 2;
$pdf->Image($img, 6 + $x, 15, 0, 178);
}
//Header
$pdf->Image('custom/Presentation/header.png', 0, 0, 297, 0);
$pdf->SetXY(0, 5);
$pdf->SetFontSize(30);
$text = decode($image_map[0]);
$pdf->MultiCell(297, 7, $text, 0, 'C');
//Footer
$pdf->Image('custom/Presentation/footer.png', 0, 187, 297, 0);
}
//Page3
if (isset($image_plan[1])) {
//.........這裏部分代碼省略.........