本文整理汇总了PHP中FPDF::SetMargins方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDF::SetMargins方法的具体用法?PHP FPDF::SetMargins怎么用?PHP FPDF::SetMargins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPDF
的用法示例。
在下文中一共展示了FPDF::SetMargins方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_id_upc_terms_handler
public function post_id_upc_terms_handler()
{
$this->id = preg_split('/[^\\d]/', $this->id, 0, PREG_SPLIT_NO_EMPTY);
$pdf = new FPDF('P', 'mm', 'Letter');
$pdf->SetMargins(6.35, 6.35, 6.35);
// quarter-inch margins
$pdf->SetAutoPageBreak(false);
$pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
$pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php');
$margins = $pdf->GetMargins();
$margins['top'] = 0.0;
$check_left_x = $margins['left'] > 3.175 ? $margins['right'] : 3.175 - $margins['left'];
$real_check_top_y = 183.675 - $margins['top'];
$check_right_x = 203.2 - $margins['left'];
$real_check_bottom_y = 255.112 - $margins['top'];
$line_height = 5;
$envelope_window_tab = 15;
$right_col1 = 130;
$right_col2 = 170;
$my_address = array('610 E 4th St', 'Duluth, MN 55805', 'Tel: 218.728.0884', 'www.wholefoods.coop');
$check_date = date('F j, Y');
$dbc = $this->connection;
$dbc->setDefaultDB($this->config->get('OP_DB'));
$signage = new COREPOS\Fannie\API\item\FannieSignage(array());
foreach ($this->id as $card_no) {
$pdf->AddPage();
$account = \COREPOS\Fannie\API\member\MemberREST::get($card_no);
$primary = array();
foreach ($account['customers'] as $c) {
if ($c['accountHolder']) {
$primary = $c;
break;
}
}
$check_number = rand(100000, 999995);
for ($i = 0; $i < 3; $i++) {
$pdf->SetFont('Gill', '', 10);
$check_top_y = $real_check_top_y - $i * 90;
$check_bottom_y = $real_check_bottom_y - $i * 90;
$pdf->SetXY($check_left_x, $check_top_y);
$pdf->Ln($line_height * 4.25);
foreach ($my_address as $line) {
$pdf->SetX($check_left_x + $envelope_window_tab + 20);
if ($line == 'www.wholefoods.coop') {
$pdf->SetFont('Gill', 'B', 9);
}
$pdf->Cell(0, $line_height, $line, 0, 1);
}
$pdf->SetFont('Gill', 'B', 10);
$pdf->SetXY($check_left_x + $right_col1, $check_top_y);
$pdf->Cell(30, $line_height, 'Check Number:', 0, 0, 'R');
$pdf->SetFont('Gill', '', 10);
$pdf->SetTextColor(0xff, 0x58, 0);
$pdf->SetX($check_left_x + $right_col2);
$pdf->Cell(30, $line_height, $check_number, 0, 0, 'R');
$pdf->SetFont('Gill', 'B', 10);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY($check_left_x + $right_col1, $check_top_y + 1.5 * $line_height);
$pdf->Cell(30, $line_height, 'Date:', 0, 0, 'R');
$pdf->SetFont('Gill', '', 10);
$pdf->SetTextColor(0xff, 0x58, 0);
$pdf->SetX($check_left_x + $right_col2);
$pdf->Cell(30, $line_height, $check_date, 0, 0, 'R');
$pdf->SetXY($check_left_x + $right_col1, $check_top_y + 3 * $line_height);
$pdf->SetFont('Gill', 'B', 10);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(30, $line_height, 'Amount:', 0, 0, 'R');
$pdf->SetXY($check_left_x + $right_col1 + 30, $check_top_y + 3 * $line_height);
$pdf->SetFont('Gill', '', 10);
$pdf->SetTextColor(0xff, 0x58, 0);
$pdf->MultiCell(40, $line_height, str_repeat(' ', 2) . $this->terms, 0, 'R');
$pdf->SetTextColor(0, 0, 0);
$their_address = array($primary['firstName'] . ' ' . $primary['lastName']);
$their_address[] = $account['addressFirstLine'];
if ($account['addressSecondLine']) {
$their_address[] = $account['addressSecondLine'];
}
$their_address[] = $account['city'] . ', ' . $account['state'] . ' ' . $account['zip'];
$pdf->SetXY($check_left_x + $envelope_window_tab, $check_top_y + 11 * $line_height);
$pdf->SetFont('Gill', 'B', 10);
foreach ($their_address as $line) {
$pdf->SetX($check_left_x + $envelope_window_tab);
$pdf->Cell(0, $line_height, $line, 0, 1);
}
$pdf->SetFont('Gill', '', 10);
$pdf->SetXY($check_left_x, $check_bottom_y + $line_height - 1);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Gill', 'B', 10);
$pdf->Cell(0, $line_height, 'Redeemable only at Whole Foods Co-op', 0, 0, 'C');
$pdf->SetFont('Gill', '', 10);
$pdf->SetXY($check_left_x + 145, $check_top_y + 6 * $line_height + 1);
$pdf->SetFont('Gill', '', 8);
$pdf->MultiCell(50, $line_height - 2, 'Limit one per day. Cannot be applied to previous purchases. No cash value.');
$pdf->SetFont('Gill', '', 10);
$pdf->SetFillColor(0xcc, 0xcc, 0xcc);
$pdf->Rect($check_left_x + 84, $check_top_y + 28, 39, 15, 'F');
$pdf->SetFillColor(0, 0, 0);
$signage->drawBarcode(ltrim($this->upc, '0'), $pdf, $check_left_x + 87, $check_top_y + 30, array('height' => 11, 'fontsize' => 0));
$pdf->Image('logo.rgb.noalpha.png', $check_left_x + $envelope_window_tab, $check_top_y + 20, 20);
$pdf->SetFont('Gill', 'B', '31');
//.........这里部分代码省略.........
示例2: preprocess
function preprocess()
{
if (FormLib::get_form_value('start', False) !== False) {
$pdf = new FPDF('P', 'in', 'Letter');
$pdf->SetMargins(0.5, 0.5, 0.5);
$pdf->SetAutoPageBreak(False, 0.5);
$pdf->AddPage();
$start = FormLib::get_form_value('start');
$x = 0.5;
$y = 0.5;
$pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
$pdf->SetFont('Gill', '', 16);
for ($i = 0; $i < 40; $i++) {
$current = $start + $i;
$pdf->SetXY($x, $y);
$pdf->Cell(1.75, 0.5, $current, 0, 0, 'C');
$pdf->Cell(1.75, 0.5, $current, 0, 0, 'C');
if ($i % 2 == 0) {
$x += 1.75 * 2 + 0.5;
} else {
$x = 0.5;
$y += 0.5;
}
}
$pdf->Close();
$pdf->Output("mem stickers {$start}.pdf", "I");
return False;
}
return True;
}
示例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: 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();
}
示例5:
function class_pdf_maker($orientation = 'P', $unit = 'in', $format = 'letter')
{
parent::FPDF($orientation, $unit, $format);
parent::SetMargins(0, 0);
parent::Open();
parent::AddPage();
parent::SetAutoPageBreak(FALSE);
}
示例6: drawPDF
public function drawPDF()
{
$pdf = new \FPDF('L', 'mm', 'Letter');
$pdf->SetMargins(3.175, 3.175, 3.175);
$pdf->SetAutoPageBreak(false);
$pdf = $this->loadPluginFonts($pdf);
$pdf->SetFont($this->font, '', 16);
$data = $this->loadItems();
$count = 0;
$sign = 0;
$width = 136.52;
$height = 108;
$top = 30;
$left = 15;
$effective_width = $width - 2 * $left;
foreach ($data as $item) {
if ($count % 4 == 0) {
$pdf->AddPage();
$sign = 0;
}
$row = floor($sign / 2);
$column = $sign % 2;
$price = $this->printablePrice($item);
$pdf->SetXY($left + $width * $column, $top + $row * $height);
$pdf->SetFont($this->font, 'B', $this->SMALL_FONT);
$pdf->Cell($effective_width, 10, $item['brand'], 0, 1, 'C');
$pdf->SetX($left + $width * $column);
$pdf->SetFont($this->font, '', $this->MED_FONT);
$item['description'] = str_replace("\r", '', $item['description']);
$pdf->Cell($effective_width, 10, str_replace("\n", '', $item['description']), 0, 1, 'C');
$pdf->SetX($left + $width * $column);
$pdf->SetFont($this->alt_font, '', $this->SMALLER_FONT);
$item['size'] = $this->formatSize($item['size'], $item);
$pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C');
$pdf->SetXY($left + $width * $column, $top + $row * $height + 35);
$pdf->SetFont($this->font, '', $this->BIG_FONT);
$pdf->Cell($effective_width, 20, $price, 0, 1, 'C');
if ($item['startDate'] != '' && $item['endDate'] != '') {
// intl would be nice
$datestr = $this->getDateString($item['startDate'], $item['endDate']);
$pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 20));
$pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT);
$pdf->Cell($effective_width, 20, $datestr, 0, 1, 'R');
}
if ($item['originShortName'] != '' || isset($item['nonSalePrice'])) {
$pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 20));
$pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT);
$text = $item['originShortName'] != '' ? $item['originShortName'] : sprintf('Regular Price: $%.2f', $item['nonSalePrice']);
$pdf->Cell($effective_width, 20, $text, 0, 1, 'L');
}
$count++;
$sign++;
}
$pdf->Output('Signage4UpL.pdf', 'I');
}
示例7: __construct
/**
* Constructor method
* @param $orientation Page orientation
* @param $format Page format
* @author Pablo Dall'Oglio
*/
public function __construct($orientation = 'P', $format = 'a4')
{
parent::__construct($orientation, 'pt', $format);
$this->setLocale();
parent::SetAutoPageBreak(true);
parent::SetMargins(0, 0, 0);
parent::SetCreator('Adianti Studio PDF Designer');
// parent::SetTitle('Letter');
// parent::SetKeywords('www.xyz.com.br');
parent::SetFillColor(255, 255, 255);
parent::Open();
parent::AliasNbPages();
parent::SetX(20);
$this->replaces = array();
$this->href = '';
$this->anchors = array();
$this->orientation = $orientation;
$this->format = $format;
parent::SetFont('Arial', '', 10 * 1.3);
}
示例8: FPDF
if($align == 2) // alineación derecha
{
$espacios = $long - $n;
for($i = 1; $i <= $espacios; $i++)
{
$texto = " " . $texto;
}
}
return $texto;
}
include("./fpdf/fpdf.php");
$pdf=new FPDF('L', 'mm', 'A4');
$pdf->SetMargins(4, 4, 4);
$pdf->Open();
$sueldobase = 0;
$compensacion = 0;
$prima = 0;
$aguinaldo = 0;
$otrasper = 0;
$isr = 0;
$imss = 0;
$otrasded = 0;
$neto = 0;
$Ssueldobase = 0;
$Scompensacion = 0;
示例9: escribe
$DistritoEducativo = $config->mostrarConfig("DistritoEducativo", 1);
$DistritoEscolar = $config->mostrarConfig("DistritoEscolar", 1);
$NombreUnidad = $config->mostrarConfig("NombreUnidad", 1);
$TipoUnidadEducativa = $config->mostrarConfig("TipoUnidadEducativa", 1);
$Sie = $config->mostrarConfig("Sie", 1);
$TurnoUnidad = $config->mostrarConfig("TurnoUnidad", 1);
$Localidad = $config->mostrarConfig("Localidad", 1);
function escribe($x, $y, $t, $tam = 12)
{
global $pdf;
$pdf->SetFont('Arial', '', $tam);
$pdf->SetXY($x, $y);
$pdf->Cell(5, 4, utf8_decode(mb_strtoupper($t, "utf8")), 0, 0, "C");
}
$pdf = new FPDF("P", "mm", array(216, 330));
$pdf->SetMargins(0, 0, 0);
$pdf->SetAutoPageBreak(true, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->AddPage();
$pdf->Image("../../imagenes/rude/rude2012.jpg", 0, 0, 216, 330);
//Codigo Sie
escribe(167.5, 29, $Sie[strlen($Sie) - 8]);
escribe(172, 29, $Sie[strlen($Sie) - 7]);
escribe(176.5, 29, $Sie[strlen($Sie) - 6]);
escribe(181, 29, $Sie[strlen($Sie) - 5]);
escribe(185.5, 29, $Sie[strlen($Sie) - 4]);
escribe(190, 29, $Sie[strlen($Sie) - 3]);
escribe(194.5, 29, $Sie[strlen($Sie) - 2]);
escribe(199, 29, $Sie[strlen($Sie) - 1]);
switch ($TipoUnidadEducativa) {
case 'Privada':
示例10: printBody
$clearance_model = new ClearanceStatus();
foreach ($listOfSignatories["id"] as $key => $value) {
$status = $clearance_model->getOverallSignatoryClearanceStatus($stud_id, $value, $current_sysemID);
if ($status == "No Requirements") {
$status = "Cleared";
}
$listOfSignatories["status"][$key] = $status;
}
//var_dump($listOfSignatories);
$fpdf = new FPDF('P', 'mm', 'Legal');
$fpdf->SetDisplayMode('fullpage', 'continuous');
$fpdf->SetTitle("SOCS Clearance - Export Copy");
$fpdf->SetCreator("USEP SOCS");
$fpdf->SetAuthor("University of Southeastern Philippines");
$fpdf->SetSubject("Electronic Clearance (export copy)");
$fpdf->SetMargins(15, 15, 15);
$fpdf->AddPage();
$fpdf->SetY('15');
$fpdf->Image('logo.jpg', 13, $fpdf->GetY() - 5, 25);
printBody();
$fpdf->Cell(0, 0, "Registrar's Copy", 0, 1, 'R', false);
$fpdf->Ln(4);
$fpdf->Cell(0, 0, "", 1, 1, 'L', true);
$fpdf->Ln(4);
$fpdf->Cell(0, 0, "Adviser's Copy", 0, 1, 'R', false);
$fpdf->SetY($fpdf->GetY() + 10);
$fpdf->Image('logo.jpg', 13, $fpdf->GetY() - 5, 25);
printBody();
function printBody()
{
global $fpdf, $stud_id, $stud_gender, $stud_name, $stud_year, $stud_course, $stud_dept, $current_sem, $current_sy, $listOfSignatories, $signatory_model;
示例11: create5160MailingLabelFile
public function create5160MailingLabelFile($results, $name = "dummy_")
{
$name .= date("M_d_Y") . ".pdf";
$fpdf = new FPDF();
$fpdf->Open();
$fpdf->AddPage();
$fpdf->SetFont('Arial', 'B', 10);
$fpdf->SetMargins(0, 0);
$fpdf->SetAutoPageBreak(false);
$x = 0;
$y = 0;
// create the array of the ids want to query the database for addresses
foreach ($results as $student) {
$st = new PSUPerson($student['spriden_id'], array('address'));
$LabelText = sprintf("%s\n%s\n%s, %s, %s", $student['spriden_last_name'] . ", " . $student['spriden_first_name'] . " " . $student['spriden_mi'], $st->address['CA'][0]->street_line1, $st->address['CA'][0]->city, $st->address['CA'][0]->stat_code, $st->address['CA'][0]->zip);
$this->Avery5160($x, $y, $fpdf, $LabelText);
$y++;
// next row
if ($y == 10) {
// end of page wrap to next column
$x++;
$y = 0;
if ($x == 3) {
// end of page
$x = 0;
$y = 0;
$fpdf->AddPage();
}
}
$st->destroy();
}
echo $fpdf->Output($name, $destination = 'd');
}
示例12: SetMargins
function SetMargins($left, $top, $right = -1)
{
parent::SetMargins($left, $top, $right);
$this->_makePageSize();
}
示例13: 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] . ' ';
}
//.........这里部分代码省略.........
示例14: FPDF
fwrite($fh, $telephone."\n");
fwrite($fh, "\n\n");
fwrite($fh, $fullclient1."\n");
fwrite($fh, $fullclient2."\n");
fwrite($fh, $fullclient3."\n");
fwrite($fh, "\n\n");
fwrite($fh, "Pet ID # ".$petid." A ".$gender." ".$speciesdesc." named ".$petinfo."\n");
fwrite($fh, "Date of Visit: ".$date." \n");
fwrite($fh, "Temperature was ".$temp." Weight was ".$weight." Pulse was ".$pulse."\n");
fclose($fh);
*/
$filename = "./notes/visit" . $petid . ".pdf";
require_once './fpdf/fpdf.php';
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetMargins(10, 10, 10);
$pdf->SetFont('Courier', 'B', 16);
$pdf->Cell(0, 5, $coname, 0, 1, "C");
$pdf->SetFont('Courier', 'B', 14);
$pdf->Cell(0, 5, $fulladdress, 0, 1, "C");
$pdf->Cell(0, 5, $telephone, 0, 1, "C");
$pdf->Ln(5);
$pdf->Ln(5);
$pdf->SetFont('Courier', '', 12);
$pdf->Cell(0, 5, $fullclient1, 0, 1, "L");
$pdf->Cell(0, 5, $fullclient2, 0, 1, "L");
$pdf->Cell(0, 5, $fullclient3, 0, 1, "L");
$pdf->Ln(5);
$pdf->Ln(5);
$pdf->Cell(0, 5, "Pet ID # " . $petid . " A " . $gender . " " . $speciesdesc . " named " . $petinfo, 0, 1, "L");
$pdf->Cell(0, 5, "Date of Visit: " . $date, 0, 1, "L");
示例15: Footer
$this->Cell(30, 10, 'Cetak Kartu', 1, 0, 'C');
//Line break
$this->Ln(20);
}
function Footer()
{
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial', 'I', 8);
// Page number
$this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
}
}
$pdf = new FPDF('L', 'cm', 'A4');
$pdf->AddPage();
$pdf->SetMargins(1.5, 3, 1.75);
$pdf->SetFont('times', '', 14);
$pdf->Cell('', 0.6, 'Kartu Berobat', 0, 1, 'C');
$pdf->Ln();
$pdf->SetFontSize(10);
$pdf->Cell(3, 0.6, 'Antiran No', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'ID Pasien', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'Nama Pasien', 1, 0, 'C');
$pdf->Cell(4, 0.6, 'Alamat', 1, 0, 'C');
$pdf->Cell(2.5, 0.6, 'Jenis Kelamin', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'Usia', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'Golongan Darah', 1, 0, 'C');
$pdf->Cell(2.5, 0.6, 'No Ponsel', 1, 0, 'C');
$sql = "select * from pasien WHERE pasien_id='{$_GET['id']}' ";
foreach ($dbh->query($sql) as $data) {
$no++;