本文整理汇总了PHP中MYPDF::SetFont方法的典型用法代码示例。如果您正苦于以下问题:PHP MYPDF::SetFont方法的具体用法?PHP MYPDF::SetFont怎么用?PHP MYPDF::SetFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MYPDF
的用法示例。
在下文中一共展示了MYPDF::SetFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPage
function loadPage()
{
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->titulo = $this->getPlan();
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Red de Universidades Anahuac');
$pdf->SetTitle('Plan Estrategico');
$pdf->SetSubject($this->getPlan());
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
//$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'N', 11);
// add a page
$pdf->AddPage();
$pdf->SetY(5);
$html = "\n<!-- EXAMPLE OF CSS STYLE -->\n<style> \n\ttd{\n\tborder:1px solid #666;\n\t}\n\t\n\ttd.title{\n\tbackground:#E5E5E5;\n\tpadding:10px;\n\t}\n \n</style> <br />";
$html .= $this->Model->getLineas();
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
//Close and output PDF document
$pdf->Output('plan_operativo.pdf', 'I');
}
示例2:
$pdf->SetSubject('Primera Factura');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set margins
$pdf->SetMargins(15, 20, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// borra la linea de arriba en el area del header
$pdf->setPrintHeader(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set some language-dependent strings (optional)
if (@file_exists('/includes/tcpdf/examples/lang/spa.php')) {
require_once '/includes/tcpdf/examples/lang/spa.php';
$pdf->setLanguageArray($l);
}
$pdf->SetFont('helvetica', 'B', 11);
$nit = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;
$sfc = $invoice->sfc;
// add a page
$pdf->AddPage('P', 'LETTER');
//contenido del recuadro
$html = '
<table border="0" width="160">
<tr>
<td style="font-size:8px">NIT:</td>
<td align="left" style="font-size:10px">: ' . $nit . '</td>
</tr>
<tr>
<td style="font-size:8px">FACTURA Nº</td>
示例3: pdfGen
function pdfGen($group_name, $mode = NULL, $start_date, $end_date, $stats, $l, $title, $path_www)
{
global $centreon_path;
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator("PDF Reports Module");
$pdf->SetAuthor(getGeneralOptInfo("pdfreports_report_author"));
//$pdf->SetAuthor('Fully Automated Nagios');
$pdfTitle = $title . " " . $group_name;
//$pdfTitle = "Rapport de supervision du hostgroup ".$group_name;
$pdf->SetTitle($pdfTitle);
//$pdf->SetSubject('TCPDF Tutorial');
//$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// define default header data
$header = $title . " " . $group_name;
//$header = "Rapport de supervision du hostgroup ".$group_name;
//$ip = $_SERVER['HOSTNAME'];
$startDate = date("d/m/Y", $start_date);
$time = time();
$endDate = date("d/m/Y", $time);
$string = _("From") . " " . strftime("%A", $start_date) . " " . $startDate . " " . _("to") . " " . strftime("%A", $time) . " " . $endDate . "\n";
// set default header data
$pdf->SetHeaderData('../../../img/headers/' . getGeneralOptInfo("pdfreports_report_header_logo"), PDF_HEADER_LOGO_WIDTH, $header, $string);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 12);
// add a page
$pdf->AddPage();
//Column titles
$header = array('Status', 'Time', 'Total Time', 'Mean Time', 'Alert');
// Pie chart Generation
$piechart_img = pieGen($stats, $mode);
//Data loading
$data = $pdf->LoadData($stats);
// print colored table
//$pdf->ColoredTable($header, $data,$chart_img);
if ($mode == "hgs") {
// Hostgroup
$pdf->ColoredTable($header, $data, $piechart_img, $path_www);
} else {
if ($mode == "sgs") {
// Servicegroup
$pdf->ServicesColoredTable($header, $data, $piechart_img, $path_www);
}
}
// ---------------------------------------------------------
//génération d'un nom de pdf
$endDay = date("d", $time);
$endYear = date("Y", $time);
$endMonth = date("m", $time);
$pdfDirName = getGeneralOptInfo("pdfreports_path_gen") . $endYear . $endMonth . $endDay . "/";
$pdfFileName = $pdfDirName . $endYear . "-" . $endMonth . "-" . $endDay . "_" . $group_name . ".pdf";
if (!is_dir($pdfDirName)) {
mkdir($pdfDirName);
}
//Close and output PDF document
$pdf->Output($pdfFileName, 'F');
return $pdfFileName;
}
示例4: Footer
{
public function Footer()
{
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 8);
$this->Cell(0, 10, 'Page ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
}
$pdf = new MYPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(15, 10, 15);
$pdf->setPrintHeader(false);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->AddPage();
foreach (tampilData($stmt) as $grid) {
$pdf->SetFont('helvetica', 'B', 9);
$pdf->setXY(15, $pdf->getY(), true);
$pdf->Cell(0, 0, 'SLIP KOMISI SALES', 0, 2, 'C', 0, '', '');
$pdf->SetFont('helvetica', '', 7);
$pdf->setXY(15, $pdf->getY(), true);
$pdf->Cell(0, 0, 'PT. LUXINDO RAYA', 0, 2, 'C', 0, '', '');
$pdf->SetFont('helvetica', 'B', 7);
$pdf->setXY(15, $pdf->getY(), true);
$pdf->MultiCell(15, 7, "NIS", 0, 'L', false, 0, '', '', false, 0, false, false, 7, 'M');
$pdf->MultiCell(5, 7, ":", 0, 'L', false, 0, '', '', false, 0, false, false, '', 'M');
$pdf->MultiCell(100, 7, $grid['nis'], 0, 'L', false, 0, '', '', false, 0, false, false, '', 'M');
$pdf->MultiCell(18, 7, "Periode", 0, 'L', false, 0, '', '', false, 0, false, false, '', 'M');
$pdf->MultiCell(5, 7, ":", 0, 'L', false, 0, '', '', false, 0, false, false, '', 'M');
$pdf->MultiCell(45, 7, $begin . " s.d " . $end, 0, 'L', false, 1, '', '', false, 0, false, false, '', 'M');
$pdf->setXY(15, $pdf->getY() - 2, true);
$pdf->MultiCell(15, 7, "Nama", 0, 'L', false, 0, '', '', false, 0, false, false, 7, 'T');
示例5: Conectar
$pdf->SetAuthor('Recaudacion');
$pdf->SetTitle('Programa de Servicio de Salud');
$pdf->SetSubject('Detalle programa paciente');
$pdf->SetKeywords('Paciente, PSS, Programa');
//$pdf->SetHeaderData('../../img/logo.jpg', PDF_HEADER_LOGO_WIDTH,'SERVICIO DE SALUD ARICA ','HOSPITAL REGIONAL DE ARICA Y PARINACOTA');
$pdf->setHeaderFont(array('helvetica', '', 18));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(4, 5, 5, 1);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(0);
$pdf->SetAutoPageBreak(TRUE, 0);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l);
$pdf->setFontSubsetting(true);
$pdf->SetFont('helvetica', '', 9, '', true);
$pdf->setPrintFooter(false);
//CREA UNA PAGINA
$pdf->AddPage('L', 'A4');
//CARGA DE CLASES Y METODOS
require_once '../../class/Tipo_Producto.class.php';
$objTipPro = new Tipo_Producto();
require_once '../../class/Nota_Credito.class.php';
$objNot = new Nota_Credito();
require_once '../../class/Conectar.class.php';
$objCon = new Conectar();
require_once '../../class/Arqueo.class.php';
$objArq = new Arqueo();
require_once '../../class/Boleta.class.php';
$objBol = new Boleta();
require_once '../../class/Pagos.class.php';
示例6: MYPDF
$this->AliasNbPages();
if (!isset($this->original_lMargin)) {
$this->original_lMargin = $this->lMargin;
}
if (!isset($this->original_rMargin)) {
$this->original_rMargin = $this->rMargin;
}
include "modules/SalesOrder/pdf_templates/footer.php";
}
}
$page_num = '1';
// create new PDF document
//$pdf = new PDF( 'P', 'mm', 'A4' );
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
// set font
$pdf->SetFont($default_font, " ", $default_font_size);
$pdf->setPrintHeader(0);
//header switched off permanently
// auto break on
//$pdf->SetAutoPageBreak(true);
// set footer fonts
//$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set pdf information
$pdf->SetTitle($pdf_strings['FACTURE'] . ": " . $account_name);
$pdf->SetAuthor($owner_firstname . " " . $owner_lastname . ", " . $org_name);
$pdf->SetSubject($account_name);
$pdf->SetCreator('PDF Creator from www.crm-now.com');
示例7: array
$pdf->SetTitle('Receipt');
$pdf->SetSubject('Payment');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
//$pdf->SetHeaderData(PDF_RECEIPT_LOGO, PDF_RECEIPT_LOGO_WIDTH, PDF_RECEIPT_TITLE, PDF_HEADER_STRING, array(0,0,0), array(0,0,0));
//$pdf->setHeaderFont(Array(PDF_FONT_NAME_RECEIPT, '', PDF_FONT_SIZE_RECEIPT));
//$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_INVOICE_LEFT, PDF_INVOICE_TOP, PDF_INVOICE_RIGHT);
$pdf->SetHeaderMargin(PDF_INVOICE_HEADER);
$pdf->SetFooterMargin(PDF_INVOICE_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_INVOICE_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l);
$pdf->SetFont('times', '', 10, '', true);
$pdf->AddPage();
$spacing = -0.01;
$stretching = 75;
$pdf->setFontStretching($stretching);
$pdf->setFontSpacing($spacing);
$titling = <<<EOD
<strong> <font style="font-size:11">Pharmacy Sys</font> </strong> <br> <strong>Official Receipt</strong><br>
Student Center Ground Floor,<br> P.O. Box Private Bag Kabarak, Kenya <br> Tel: +254 702 937 925 <br> E-mail: pharmacysys@yahoo.com
<br>-----------------------------------------
EOD;
$header = array('Drug', 'Price.', 'Qtty', 'Cost(Kshs.)');
$ddt = <<<EOD
{$time}
EOD;
$html = <<<EOD
示例8: dirname
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// set pdf viewer preferences
$pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge'));
//Doppelseitiger Druck in einem Befehl
$pdf->SetBooklet(true, 15, 25);
// start of creating the documents
while ($meineSchueler = mysql_fetch_assoc($meineSchueler_tmp)) {
$schueler_uid = $meineSchueler['usr_id'];
$schueler_vorname = $meineSchueler['firstname'];
$schueler_nachname = $meineSchueler['lastname'];
$pdf->SetFont('times', '', 14);
$pdf->setPrintHeader(true);
// add a page
$pdf->AddPage('P', 'A4');
//personenbezogene Kopfdaten
$pdf->SetXY(20, 42);
$pdf->Cell(45, 5, $schueler_nachname . ', ' . $schueler_vorname, 0, 0, 'L', 0, '', 0, false, 'C', 'C');
$pdf->Cell(0, 5, $klassenbezeichner . ': ' . $kl, 0, 1, 'R', 0, '', 0, false, 'C', 'C');
$pdf->Line(20, 47, 195, 47, $style2);
$pdf->SetFont('helvetica', '', 14);
$pdf->SetY(52);
$pdf->SetFont('helvetica', 'B', 14);
$pdf->MultiCell(0, 2, '', 0, 'L', 0, 1, '', '', true);
//als verticaler Abstand, mir fiel grad nichts besseres ein
$pdf->Cell(45, 5, 'Deine Lernziele im ' . $_SESSION['aktueller_term_name'], 0, 1, 'L', 0, '', 0, false, 'C', 'C');
$pdf->MultiCell(0, 1, '', 0, 'L', 0, 1, '', '', true);
示例9: dirname
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// remove default footer
$pdf->setPrintFooter(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 7);
// add a page
$pdf->AddPage();
//$pdf->Write(0, 'Taller industrial Servi Torno tiene el agrado de cotizarle los siguientes servicios:', '', 0, 'L', true, 0, false, false, 0);
//$pdf->SetFont('helvetica', '', 6);
///////////////////////////////////////////////////////
//////////////encabezado//////////////////
////////////////////////////////////////////////////////
$tbl = <<<EOD
<hr id="Line1" style="margin:0;padding:0;position:absolute;left:0px;top:44px;width:625px;height:1px;z-index:1;">
<div id="wb_Text1" style="position:absolute;left:380px;top:71px;width:150px;height:10px;text-align:center;z-index:2;">
示例10:
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', 'BI', 12);
// add a page
$pdf->AddPage();
//$pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
$htmlcode = '<table cellpadding="6" >
<tr>
<td style="text-align:center;width:635px; height:344px;"><img src="'.base_url.'images/firstpage.jpg"></td>
</tr>
<tr><td></td></tr>
<tr>
<td colspan="3" style="color:#06ADB6; font-weight:bold;font-size:34px;text-align:center;width:635px;"><center>MY FUNERAL PLAN<center/></td>
示例11:
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
//initialize document
$pdf->AliasNbPages();
// set font
$pdf->SetFont("times", "BI", 12);
// Start Page Group
$pdf->startPageGroup();
// add a page
$pdf->AddPage();
$pdf->Cell(0, 10, "Start of group 1", 0, 1, 'L');
$pdf->AddPage();
// Start new Page Group
$pdf->startPageGroup();
$pdf->AddPage();
$pdf->Cell(0, 10, "Start of group 2", 0, 1, 'L');
$pdf->AddPage();
$pdf->AddPage();
$pdf->AddPage();
//Close and output PDF document
$pdf->Output("example_023.pdf", "I");
示例12:
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// Set some content to print
$tbl_header = '<style>
table {
border: 1px solid grey;
border-collapse: collapse;
border-spacing: 0;
margin: 0 20px;
}
tr {
border-collapse: collapse;
border: 1px solid grey;
padding: 3px 0;
示例13: gettext
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
//set auto page breaks
$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
//$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// first page
$pdf->AddPage();
$pdf->Line(20, 20, 190, 20);
$pdf->ImageEps('../extensions/exam_organization/images/upb_logo.ai', 30, 30, 13);
$pdf->SetFont('helvetica', '', 16);
$pdf->MultiCell(80, 3, gettext("exam results"), 0, 'C', 0, 0, 75, 25);
$pdf->SetFont('helvetica', 'B', 16);
$pdf->MultiCell(130, 3, $exam_name, 0, 'C', 0, 0, 50, 33);
$pdf->MultiCell(130, 3, $date . " (" . $semester . ")", 0, 'C', 0, 0, 50, 40);
$pdf->SetFont('helvetica', '', 10);
//$pdf->MultiCell(130, 2, "Prof. Dr. Reinhard Keil", 0, 'C', 0, 0, 50, 50);
$pdf->Line(20, 60, 190, 60);
$eoDatabase = exam_organization_database::getInstance();
$eoDatabase->calculateExamResults($course);
$participants = $eoDatabase->getParticipantsForTerm($examTerm);
$notPassed = 0;
//get exam key
$examObject = exam_organization_exam_object_data::getInstance($course);
$examKey = $examObject->getExamKey($examTerm);
$maxPoints = $examObject->getExamKeyMaxPoints($examTerm);
示例14: array
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
//-----------------------------
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(15, 30, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set font
$pdf->SetFont('helvetica', '', 9);
# creamos una página en blanco
$pdf->Addpage();
$pdf->SetFont('helvetica', '', 9);
// define barcode style
$style = array('position' => 'R', 'align' => 'C', 'stretch' => 0, 'fitwidth' => 1, 'cellfitalign' => '', 'border' => 1, 'hpadding' => '2', 'vpadding' => '2', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'Helvetica', 'fontsize' => 6, 'stretchtext' => 4);
$styleBC = array('position' => 'R', 'border' => 1, 'padding' => 2, 'fgcolor' => array(0, 0, 0), 'bgcolor' => array(255, 255, 255), 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
$estilo_tabla = "<style>\r\n .tablaFicha{\r\n width: 100%;\r\n font-size: 10px; \r\n }\r\n .celdaTablaFicha{\r\n border: 1px solid #CCCCCC;\r\n vertical-align: middle;\r\n }\r\n .fecha{\r\n text-align: right;\r\n }\r\n .encabezado{\r\n background-color: #EFEFEF;\r\n }\r\n</style>";
$sTituloReporte = "FICHA DE INGRESO A BANCO DE PROYECTOS";
//--------------------Contenido del reporte >---------------------------------------------------
$pdf->SetFont('times', 'L', 6);
$pdf->write1DBarcode($infoBcoPDF['IdBco'], 'C39', '', '', '', 12, 0.4, $style, 'N');
$pdf->Ln();
$pdf->SetFont('times', '', 9);
$pdf->Cell(0, 0, strtoupper($sTituloReporte), 0, 1, 'C', 0, 1);
$pdf->Ln(2);
示例15: MYPDF
<?php
$pdf = new MYPDF();
//$pdf->setMargins(20,20,20);
$pdf->AliasNbPages();
$pdf->AddPage('L', 'A4');
$pdf->AddFont('PT_Serif-Web-Bold', '', 'PT_Serif-Web-Bold.php');
$pdf->SetFont('PT_Serif-Web-Bold', '', 32);
$pdf->image('./images/lippo.jpg', 25, 4, 50, 30);
$pdf->Text(290 / 2 - $pdf->GetStringWidth('Lumiere Club') / 2, 15, 'Lumiere Club');
$pdf->SetFont('PT_Serif-Web-Bold', '', 30);
$pdf->Text(290 / 2 - $pdf->GetStringWidth('Lippo Mall Kemang') / 2, 26, 'Lippo Mall Kemang');
$pdf->SetFont('Times', '', 12);
$pdf->Text(290 / 2 - $pdf->GetStringWidth('Jl. Pangeran Antasari 36 Jakarta Selatan - 12150') / 2, 33, 'Jl. Pangeran Antasari 36 Jakarta Selatan - 12150');
//$pdf->setDrawColor(105,102,102);
$pdf->Line(10, 36, 290 - 5, 36);
$pdf->SetFont('Arial', '', 22);
$pdf->Text(290 / 2 - $pdf->GetStringWidth('Report Data Upgrade Membership') / 2, 45, 'Report Data Upgrade Membership');
$awal = date('d F Y', strtotime($tgl1));
$akhir = date('d F Y', strtotime($tgl2));
$periode = "{$awal} to {$akhir}";
$pdf->SetFont('Arial', '', 14);
$pdf->Text(290 / 2 - $pdf->GetStringWidth($periode) / 2, 54, $periode);
//$pdf->Line(10, 10, 210-10, 10);
$pdf->SetXY(10, 60);
$pdf->SetFont('Helvetica', '', 12);
$content = UpgradeMembership::model()->with(array('member', 'user'))->findAll(array('condition' => 'upgrade_date BETWEEN :date1 AND :date2', 'params' => array(':date1' => $tgl1, ':date2' => $tgl2)));
if ($content == null) {
$pdf->SetFont('Helvetica', '', 48);
$pdf->Text(290 / 2 - $pdf->GetStringWidth("No Data Found") / 2, 84, "No Data Found");
$pdf->Output();