本文整理汇总了PHP中TCPDF::SetDrawColor方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::SetDrawColor方法的具体用法?PHP TCPDF::SetDrawColor怎么用?PHP TCPDF::SetDrawColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::SetDrawColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPdfOutput
//.........这里部分代码省略.........
$style5 = array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 64, 128));
$style6 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,10', 'color' => array(0, 128, 0));
$style7 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 128, 0));
// Line
$pdf->Text(5, 4, 'Line examples');
$pdf->Line(5, 10, 80, 30, $style);
$pdf->Line(5, 10, 5, 30, $style2);
$pdf->Line(5, 10, 80, 10, $style3);
// Rect
$pdf->Text(100, 4, 'Rectangle examples');
$pdf->Rect(100, 10, 40, 20, 'DF', $style4, array(220, 220, 200));
$pdf->Rect(145, 10, 40, 20, 'D', array('all' => $style3));
// Curve
$pdf->Text(5, 34, 'Curve examples');
$pdf->Curve(5, 40, 30, 55, 70, 45, 60, 75, null, $style6);
$pdf->Curve(80, 40, 70, 75, 150, 45, 100, 75, 'F', $style6);
$pdf->Curve(140, 40, 150, 55, 180, 45, 200, 75, 'DF', $style6, array(200, 220, 200));
// Circle and ellipse
$pdf->Text(5, 79, 'Circle and ellipse examples');
$pdf->SetLineStyle($style5);
$pdf->Circle(25, 105, 20);
$pdf->Circle(25, 105, 10, 90, 180, null, $style6);
$pdf->Circle(25, 105, 10, 270, 360, 'F');
$pdf->Circle(25, 105, 10, 270, 360, 'C', $style6);
$pdf->SetLineStyle($style5);
$pdf->Ellipse(100, 103, 40, 20);
$pdf->Ellipse(100, 105, 20, 10, 0, 90, 180, null, $style6);
$pdf->Ellipse(100, 105, 20, 10, 0, 270, 360, 'DF', $style6);
$pdf->SetLineStyle($style5);
$pdf->Ellipse(175, 103, 30, 15, 45);
$pdf->Ellipse(175, 105, 15, 7.5, 45, 90, 180, null, $style6);
$pdf->Ellipse(175, 105, 15, 7.5, 45, 270, 360, 'F', $style6, array(220, 200, 200));
// Polygon
$pdf->Text(5, 129, 'Polygon examples');
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->Polygon(array(5, 135, 45, 135, 15, 165));
$pdf->Polygon(array(60, 135, 80, 135, 80, 155, 70, 165, 50, 155), 'DF', array($style6, $style7, $style7, 0, $style6), array(220, 200, 200));
$pdf->Polygon(array(120, 135, 140, 135, 150, 155, 110, 155), 'D', array($style6, 0, $style7, $style6));
$pdf->Polygon(array(160, 135, 190, 155, 170, 155, 200, 160, 160, 165), 'DF', array('all' => $style6), array(220, 220, 220));
// Polygonal Line
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 164)));
$pdf->PolyLine(array(80, 165, 90, 160, 100, 165, 110, 160, 120, 165, 130, 160, 140, 165), 'D', array(), array());
// Regular polygon
$pdf->Text(5, 169, 'Regular polygon examples');
$pdf->SetLineStyle($style5);
$pdf->RegularPolygon(20, 190, 15, 6, 0, 1, 'F');
$pdf->RegularPolygon(55, 190, 15, 6);
$pdf->RegularPolygon(55, 190, 10, 6, 45, 0, 'DF', array($style6, 0, $style7, 0, $style7, $style7));
$pdf->RegularPolygon(90, 190, 15, 3, 0, 1, 'DF', array('all' => $style5), array(200, 220, 200), 'F', array(255, 200, 200));
$pdf->RegularPolygon(125, 190, 15, 4, 30, 1, null, array('all' => $style5), null, null, $style6);
$pdf->RegularPolygon(160, 190, 15, 10);
// Star polygon
$pdf->Text(5, 209, 'Star polygon examples');
$pdf->SetLineStyle($style5);
$pdf->StarPolygon(20, 230, 15, 20, 3, 0, 1, 'F');
$pdf->StarPolygon(55, 230, 15, 12, 5);
$pdf->StarPolygon(55, 230, 7, 12, 5, 45, 0, 'DF', array('all' => $style7), array(220, 220, 200), 'F', array(255, 200, 200));
$pdf->StarPolygon(90, 230, 15, 20, 6, 0, 1, 'DF', array('all' => $style5), array(220, 220, 200), 'F', array(255, 200, 200));
$pdf->StarPolygon(125, 230, 15, 5, 2, 30, 1, null, array('all' => $style5), null, null, $style6);
$pdf->StarPolygon(160, 230, 15, 10, 3);
$pdf->StarPolygon(160, 230, 7, 50, 26);
// Rounded rectangle
$pdf->Text(5, 249, 'Rounded rectangle examples');
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->RoundedRect(5, 255, 40, 30, 3.5, '1111', 'DF');
$pdf->RoundedRect(50, 255, 40, 30, 6.5, '1000');
$pdf->RoundedRect(95, 255, 40, 30, 10.0, '1111', null, $style6);
$pdf->RoundedRect(140, 255, 40, 30, 8.0, '0101', 'DF', $style6, array(200, 200, 200));
// Arrows
$pdf->Text(185, 249, 'Arrows');
$pdf->SetLineStyle($style5);
$pdf->SetFillColor(255, 0, 0);
$pdf->Arrow(200, 280, 185, 266, 0, 5, 15);
$pdf->Arrow(200, 280, 190, 263, 1, 5, 15);
$pdf->Arrow(200, 280, 195, 261, 2, 5, 15);
$pdf->Arrow(200, 280, 200, 260, 3, 5, 15);
// - . - . - . - . - . - . - . - . - . - . - . - . - . - . -
// ellipse
// add a page
$pdf->AddPage();
$pdf->Cell(0, 0, 'Arc of Ellipse');
// center of ellipse
$xc = 100;
$yc = 100;
// X Y axis
$pdf->SetDrawColor(200, 200, 200);
$pdf->Line($xc - 50, $yc, $xc + 50, $yc);
$pdf->Line($xc, $yc - 50, $xc, $yc + 50);
// ellipse axis
$pdf->SetDrawColor(200, 220, 255);
$pdf->Line($xc - 50, $yc - 50, $xc + 50, $yc + 50);
$pdf->Line($xc - 50, $yc + 50, $xc + 50, $yc - 50);
// ellipse
$pdf->SetDrawColor(200, 255, 200);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 0, 360, 'D', array(), array(), 2);
// ellipse arc
$pdf->SetDrawColor(255, 0, 0);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 45, 90, 'D', array(), array(), 2);
$this->comparePdfs($pdf);
}
示例2: _set_fill_colour
/**
* Sets the fill colour
*
* @param array $color
*/
protected function _set_fill_colour($colour)
{
$colour[0] = round(255 * $colour[0]);
$colour[1] = round(255 * $colour[1]);
$colour[2] = round(255 * $colour[2]);
if (is_null($this->_last_fill_color) || $color != $this->_last_fill_color) {
$this->_pdf->SetDrawColor($color[0], $color[1], $color[2]);
$this->_last_fill_color = $color;
}
}
示例3: RenderAsPDF
public function RenderAsPDF(TCPDF $oPdf, DisplayableGraph $oGraph, $fScale, $aContextDefs)
{
$oPdf->SetAlpha(1);
if ($this->GetProperty('is_reached_count') > $this->GetProperty('threshold')) {
$oPdf->SetFillColor(200, 0, 0);
} else {
$oPdf->SetFillColor(144, 144, 144);
}
$oPdf->SetDrawColor(0, 0, 0);
$oPdf->Circle($this->x * $fScale, $this->y * $fScale, 16 * $fScale, 0, 360, 'DF');
$oPdf->SetTextColor(255, 255, 255);
$oPdf->SetFont('dejavusans', '', 28 * $fScale, '', true);
$sLabel = (string) $this->GetProperty('label');
$width = $oPdf->GetStringWidth($sLabel, 'dejavusans', 'B', 24 * $fScale);
$height = $oPdf->GetStringHeight(1000, $sLabel);
$xPos = (double) $this->x * $fScale - $width / 2;
$yPos = (double) $this->y * $fScale - $height / 2;
$oPdf->SetXY(($this->x - 16) * $fScale, ($this->y - 16) * $fScale);
$oPdf->Cell(32 * $fScale, 32 * $fScale, $sLabel, 0, 0, 'C', 0, '', 0, false, 'T', 'C');
}
示例4: testPdfOutput
public function testPdfOutput()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 025');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 025', 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 (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 12);
// add a page
$pdf->AddPage();
$txt = 'You can set the transparency of PDF objects using the setAlpha() method.';
$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0);
/*
* setAlpha() gives transparency support. You can set the
* alpha channel from 0 (fully transparent) to 1 (fully
* opaque). It applies to all elements (text, drawings,
* images).
*/
$pdf->SetLineWidth(2);
// draw opaque red square
$pdf->SetFillColor(255, 0, 0);
$pdf->SetDrawColor(127, 0, 0);
$pdf->Rect(30, 40, 60, 60, 'DF');
// set alpha to semi-transparency
$pdf->SetAlpha(0.5);
// draw green square
$pdf->SetFillColor(0, 255, 0);
$pdf->SetDrawColor(0, 127, 0);
$pdf->Rect(50, 60, 60, 60, 'DF');
// draw blue square
$pdf->SetFillColor(0, 0, 255);
$pdf->SetDrawColor(0, 0, 127);
$pdf->Rect(70, 80, 60, 60, 'DF');
// draw jpeg image
$pdf->Image('tests/images/image_demo.jpg', 90, 100, 60, 60, '', 'http://www.tcpdf.org', '', true, 72);
// restore full opacity
$pdf->SetAlpha(1);
$this->comparePdfs($pdf);
}
示例5: display
//.........这里部分代码省略.........
$this->pdf->Rect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $style, $arraydata['border'], $arraydata['fillcolor']);
} elseif ($arraydata["type"] == "RoundedRect") {
if ($arraydata['mode'] == 'Transparent') {
$style = '';
} else {
$style = 'FD';
}
//
// $this->pdf->SetLineStyle($arraydata['border']);
$this->pdf->RoundedRect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $arraydata["radius"], '1111', $style, $arraydata['border'], $arraydata['fillcolor']);
} elseif ($arraydata["type"] == "Ellipse") {
//$this->pdf->SetLineStyle($arraydata['border']);
$this->pdf->Ellipse($arraydata["x"] + $arraydata["width"] / 2 + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis + $arraydata["height"] / 2, $arraydata["width"] / 2, $arraydata["height"] / 2, 0, 0, 360, 'FD', $arraydata['border'], $arraydata['fillcolor']);
} elseif ($arraydata["type"] == "Image") {
//echo $arraydata["path"];
$path = $this->analyse_expression($arraydata["path"]);
$imgtype = substr($path, -3);
$arraydata["link"] = $arraydata["link"] . "";
if ($imgtype == 'jpg' || right($path, 3) == 'jpg' || right($path, 4) == 'jpeg') {
$imgtype = "JPEG";
} elseif ($imgtype == 'png' || $imgtype == 'PNG') {
$imgtype = "PNG";
}
//echo $path;
if (file_exists($this->imagesPath . $path) || $this->left($path, 4) == 'http') {
//$path="/Applications/XAMPP/xamppfiles/simbiz/modules/simantz/images/modulepic.jpg";
// $path="/simbiz/images/pendingno.png";
if ($arraydata["link"] == "") {
$this->pdf->Image($this->imagesPath . $path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
} else {
// if($arraydata['linktarget']=='Blank' && strpos($_SERVER['HTTP_USER_AGENT'],"Safari")!==false && strpos($_SERVER['HTTP_USER_AGENT'],"Chrome")==false){
// $href="javascript:window.open('".$arraydata["link"]."');";
// $imagehtml='<A href="'.$href.'"><img src="'.$path.'" '.
// 'width="'. $arraydata["width"] .'" height="'.$arraydata["height"].'" ></A>';
// $this->pdf->writeHTMLCell($arraydata["width"],$arraydata["height"],
// $arraydata["x"]+$this->arrayPageSetting["leftMargin"],$arraydata["y"]+$y_axis,$imagehtml);
// }
// else
$this->pdf->Image($path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
}
} elseif ($this->left($path, 22) == "data:image/jpeg;base64") {
$imgtype = "JPEG";
$img = str_replace('data:image/jpeg;base64,', '', $path);
$imgdata = base64_decode($img);
$this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], '', $arraydata["link"]);
} elseif ($this->left($path, 22) == "data:image/png;base64,") {
$imgtype = "PNG";
// $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$img = str_replace('data:image/png;base64,', '', $path);
$imgdata = base64_decode($img);
$this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], '', $arraydata["link"]);
}
} elseif ($arraydata["type"] == "SetTextColor") {
$this->textcolor_r = $arraydata['r'];
$this->textcolor_g = $arraydata['g'];
$this->textcolor_b = $arraydata['b'];
if ($this->hideheader == true && $this->currentband == 'pageHeader') {
$this->pdf->SetTextColor(100, 33, 30);
} else {
$this->pdf->SetTextColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
}
} elseif ($arraydata["type"] == "SetDrawColor") {
$this->drawcolor_r = $arraydata['r'];
$this->drawcolor_g = $arraydata['g'];
$this->drawcolor_b = $arraydata['b'];
$this->pdf->SetDrawColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "SetLineWidth") {
$this->pdf->SetLineWidth($arraydata["width"]);
} elseif ($arraydata["type"] == "break") {
} elseif ($arraydata["type"] == "Line") {
$printline = false;
if ($arraydata['printWhenExpression'] == "") {
$printline = true;
} else {
$printline = $this->analyse_expression($arraydata['printWhenExpression']);
}
if ($printline) {
$this->pdf->Line($arraydata["x1"] + $this->arrayPageSetting["leftMargin"], $arraydata["y1"] + $y_axis, $arraydata["x2"] + $this->arrayPageSetting["leftMargin"], $arraydata["y2"] + $y_axis, $arraydata["style"]);
}
} elseif ($arraydata["type"] == "SetFillColor") {
$this->fillcolor_r = $arraydata['r'];
$this->fillcolor_g = $arraydata['g'];
$this->fillcolor_b = $arraydata['b'];
$this->pdf->SetFillColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "lineChart") {
$this->showLineChart($arraydata, $y_axis);
} elseif ($arraydata["type"] == "barChart") {
$this->showBarChart($arraydata, $y_axis, 'barChart');
} elseif ($arraydata["type"] == "pieChart") {
$this->showPieChart($arraydata, $y_axis);
} elseif ($arraydata["type"] == "stackedBarChart") {
$this->showBarChart($arraydata, $y_axis, 'stackedBarChart');
} elseif ($arraydata["type"] == "stackedAreaChart") {
$this->showAreaChart($arraydata, $y_axis, $arraydata["type"]);
} elseif ($arraydata["type"] == "Barcode") {
$this->showBarcode($arraydata, $y_axis);
} elseif ($arraydata["type"] == "CrossTab") {
$this->showCrossTab($arraydata, $y_axis);
}
}
示例6: btnPrint_Click
protected function btnPrint_Click()
{
if ($this->lstLabelStock->SelectedValue) {
$this->lstLabelStock->Warning = "";
set_time_limit(0);
// If the user clicked Cancel button
if ($_SESSION["intGeneratingStatus"] != -1) {
// If the user clicked outside of the modal dialog
if ($this->dlgPrintLabels->Visible && $this->dlgPrintLabels->Display) {
if ($this->intCurrentBarCodeLabel < count($this->strBarCodeArray)) {
array_push($this->strTablesBufferArray, $this->CreateTableByBarCodeArray());
$this->txtWarning->Text = "Please wait... PDF Generating: " . $_SESSION["intGeneratingStatus"] . "% Complete";
$this->txtWarning->Display = true;
$this->btnPrint->Enabled = true;
QApplication::ExecuteJavaScript("document.getElementById('" . $this->btnPrint->ControlId . "').click();");
} else {
include_once '../includes/php/tcpdf/config/lang/eng.php';
include_once '../includes/php/tcpdf/tcpdf.php';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
// Set document information
$pdf->SetCreator("Tracmor");
$pdf->SetAuthor("Tracmor");
$pdf->SetTitle("Bar Codes");
// Set PDF viewer preferences
$arrPreferences = array('PrintScaling' => 'None');
$pdf->setViewerPreferences($arrPreferences);
// Disable header and footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// Disable auto page breaks
$pdf->SetAutoPageBreak(false);
// Set some language-dependent strings
$pdf->setLanguageArray($l);
// Set the color used for all drawing operations (lines, rectangles and cell borders).
$pdf->SetDrawColor(255);
// white
// Set Cell Padding
$pdf->SetCellPadding(0);
// Set Cell Spacing
$pdf->SetLineWidth(0);
// Initialize document
$pdf->AliasNbPages();
switch ($this->lstLabelStock->SelectedValue) {
case 1:
// Labels per row for Avery 6577 (5/8" x 3")
$pdf->SetFontSize(3);
$pdf->setCellHeightRatio(2.3);
// was 1.93
// Set margins
$pdf->SetMargins(12, 12, 12);
break;
case 2:
// Labels per row for Avery 6576 (1-1/4" x 1-3/4")
$pdf->SetFontSize(3);
$pdf->setCellHeightRatio(11.0);
// was 10.2
// Set margins
$pdf->SetMargins(10, 16, 10);
break;
default:
throw new QCallerException('Label Stock Not Provided');
break;
}
foreach ($this->strTablesBufferArray as $strTableBuffer) {
// add a page
$pdf->AddPage();
// output the HTML content
$pdf->writeHTML($strTableBuffer);
}
// Close and save PDF document
$pdf->Output(".." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf", "F");
// Cleaning up
$this->btnCancel_Click();
// Uncheck all items but SelectAll checkbox
foreach ($this->GetAllControls() as $objControl) {
if (substr($objControl->ControlId, 0, 11) == 'chkSelected') {
$objControl->Checked = false;
}
}
$arrDataGridObjectNameId = $this->ctlSearchMenu->GetDataGridObjectNameId();
// Uncheck SelectAll checkbox
$this->ctlSearchMenu->{$arrDataGridObjectNameId}[0]->chkSelectAll->Checked = false;
// Open generated PDF in new window
QApplication::ExecuteJavaScript("window.open('.." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf','Barcodes','resizeable,menubar=1,scrollbar=1,left=0,top=0,width=800,height=600');");
}
} else {
// Cleaning up
$this->btnCancel_Click();
}
}
} else {
$this->lstLabelStock->Warning = "Please select one";
$this->lstLabelStock->Enabled = true;
}
}
示例7: printTableAsPdf
public function printTableAsPdf()
{
global $CFG;
define('K_PATH_CACHE', $CFG->dataroot . '/temp/');
require_once gcr::webDir . 'lib/tcpdf/config/lang/eng.php';
require_once gcr::webDir . 'lib/tcpdf/tcpdf.php';
$app = $this->user->getApp();
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator($app->getFullName());
$pdf->SetAuthor($app->getFullName());
$pdf->SetTitle('Student Transcript');
$pdf->SetSubject($this->user->getFullNameString());
$pdf->SetKeywords('transcript, course, grade');
$address = $app->getAddressObject();
$person2 = $app->getPerson2Object();
$header_string = $person2->getFullName() . "\n";
$header_string .= $address->getStreet1() . "\n";
if ($address->getStreet2() != '') {
$header_string .= $address->getStreet2() . "\n";
}
$header_string .= $address->getCity() . ', ' . $address->getState() . ' ' . $address->getZipcode() . "\n";
$header_string .= $person2->getPhone1() . "\n";
$header_string .= $person2->getPhone2() . "\n";
$header_string .= $person2->getEmail();
// set default header data
$pdf->SetHeaderData('../../../../../../..' . $app->getLogoFilePath(), 30, trim(trim($app->getFullName())) . ' Student Transcript', 'Student: ' . trim($this->user->getFullNameString()) . ', ' . $this->user->getObject()->email . "\nDate: " . date('m/d/Y', time()));
// 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', '', 8);
// add a page
$pdf->AddPage();
$mdl_user_obj = $this->user->getObject();
$html = '<b>Educational Provider Information:</b><br />';
$html .= $app->getFullName() . '<br />';
$html .= $person2->getFullName() . '<br />';
$html .= $address->getStreet1() . '<br />';
if ($address->getStreet2() != '') {
$html .= $address->getStreet2() . "<br />";
}
$html .= $address->getCity() . ', ' . $address->getState() . ' ' . $address->getZipcode() . "<br />";
$html .= $person2->getPhone1() . "<br />";
$html .= $person2->getPhone2() . "<br />";
$html .= $person2->getEmail() . '<br /><br />';
$w = array(17, 65, 50, 12, 12, 23);
$pdf->SetFillColor(255);
$pdf->SetTextColor(0);
// Data
$fill = 0;
$pdf->writeHTMLCell(array_sum($w), $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
$pdf->SetFont('helvetica', '', 8);
$row_count = $this->table->getRowCount();
$columns = $this->table->getColumns();
// Colors, line width and bold font
$pdf->SetFillColor(230, 238, 238);
$pdf->SetDrawColor(221, 221, 221);
$pdf->SetLineWidth(0.3);
$pdf->SetFont('', 'B', 8);
// Header
$pdf->Cell($w[0], 7, 'Date', 1, 0, 'L', 1);
$pdf->Cell($w[1], 7, 'Course', 1, 0, 'L', 1);
$pdf->Cell($w[2], 7, 'Instructor', 1, 0, 'L', 1);
$pdf->Cell($w[3], 7, 'Credits', 1, 0, 'L', 1);
$pdf->Cell($w[4], 7, 'Grade', 1, 0, 'L', 1);
$pdf->Cell($w[5], 7, 'Result', 1, 0, 'L', 1);
$pdf->Ln();
// Color and font restoration
$pdf->SetFillColor(240, 240, 246);
$pdf->SetFont('helvetica', '', 8);
// Data
$fill = 0;
// This convoluted code does the following for each table row:
// 1. Break the table row contents into a multidimentional
// array, $row[column][line], so that we can handle cells
// which require multiple lines because they are too long.
// 2. Print each column left to right, and repeat for each line
// required for this row.
for ($row = 1; $row < $row_count; $row++) {
$row_content = array();
$max_line_index = 0;
for ($column = 0; $column < 6; $column++) {
$max_chars = floor(0.75 * $w[$column]);
$cell_content = strip_tags($columns[$column]->getCells($row)->getContent());
$column_line_count = ceil((strlen($cell_content) + 0.1) / $max_chars);
//.........这里部分代码省略.........
示例8: array
$pdf->SetLineStyle($style5);
$pdf->SetFillColor(255, 0, 0);
$pdf->Arrow(200, 280, 185, 266, 0, 5, 15);
$pdf->Arrow(200, 280, 190, 263, 1, 5, 15);
$pdf->Arrow(200, 280, 195, 261, 2, 5, 15);
$pdf->Arrow(200, 280, 200, 260, 3, 5, 15);
// - . - . - . - . - . - . - . - . - . - . - . - . - . - . -
// ellipse
// add a page
$pdf->AddPage();
$pdf->Cell(0, 0, 'Arc of Ellipse');
// center of ellipse
$xc = 100;
$yc = 100;
// X Y axis
$pdf->SetDrawColor(200, 200, 200);
$pdf->Line($xc - 50, $yc, $xc + 50, $yc);
$pdf->Line($xc, $yc - 50, $xc, $yc + 50);
// ellipse axis
$pdf->SetDrawColor(200, 220, 255);
$pdf->Line($xc - 50, $yc - 50, $xc + 50, $yc + 50);
$pdf->Line($xc - 50, $yc + 50, $xc + 50, $yc - 50);
// ellipse
$pdf->SetDrawColor(200, 255, 200);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 0, 360, 'D', array(), array(), 2);
// ellipse arc
$pdf->SetDrawColor(255, 0, 0);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 45, 90, 'D', array(), array(), 2);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_012.pdf', 'I');
示例9: dirname
// 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', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.7);
// set color for cell border
$pdf->SetDrawColor(0, 128, 255);
$pdf->setCellHeightRatio(3);
$pdf->SetXY(15, 60);
// text on center
$pdf->Cell(30, 0, 'Top-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'C');
$pdf->Cell(30, 0, 'Center-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'C');
$pdf->Cell(30, 0, 'Bottom-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'C');
$pdf->Cell(30, 0, 'Ascent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'C');
$pdf->Cell(30, 0, 'Baseline-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'C');
$pdf->Cell(30, 0, 'Descent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'C');
$pdf->SetXY(15, 90);
// text on top
$pdf->Cell(30, 0, 'Top-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'T');
$pdf->Cell(30, 0, 'Center-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'T');
$pdf->Cell(30, 0, 'Bottom-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'T');
$pdf->Cell(30, 0, 'Ascent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'T');
示例10: printPDFOrder
/**
* print PDF order
* @param Order $order
*/
private function printPDFOrder(Order $order){
global $lang;
$product_items = $order->getProducts();
$shop = new ShopInfo($this->module_srl);
$this->model->includeTCPDF();
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, TRUE, 'UTF-8', FALSE);
// set document information
$pdf->SetCreator($shop->getShopTitle());
$pdf->SetTitle(sprintf($lang->order_with_number, $order->order_srl));
$pdf->SetSubject(sprintf($lang->order_with_number, $order->order_srl));
$pdf->setPrintHeader(FALSE);
$pdf->setPrintFooter(FALSE);
// set font
$pdf->SetFont('dejavusans', '', 10);
// add a page
$pdf->AddPage();
// create HTML content
$html = '
<div style="float:left; text-align: center;">'.$shop->getShopTitle().'</div>
<h1>'.sprintf($lang->order_with_number, $order->order_srl).'</h1>
<p></p>
Order date: '.zdate($order->regdate,'d-M-y').'
<p></p><h3>'.$lang->shipping_address.'</h3>'.$order->shipping_address.'
<p></p><h3>'.$lang->billing_address.'</h3>'.$order->billing_address.'
<p></p><h3>'.$lang->payment_method_used.'</h3>'.ucwords(str_replace('_', ' ', $order->payment_method)).'
<p></p><h3>'.$lang->shipping_method_used.'</h3>'.ucwords(str_replace('_', ' ', $order->shipping_method)).'
<p></p><h3>'.$lang->items_ordered.'</h3></br>';
// output the HTML content
$pdf->writeHTML($html, TRUE, FALSE, TRUE, FALSE, '');
// Colors, line width and bold font
$pdf->SetFillColor(38, 74, 108);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(38, 74, 108);
$pdf->SetLineWidth(0.3);
$pdf->SetFont('', 'B');
// Header
$w = array(15, 70, 20, 45, 45);
$header= $header = array($lang->product_no_dot, $lang->title, $lang->quantity, $lang->price, $lang->subtotal);
$num_headers = count($header);
for($i = 0; $i < $num_headers; ++$i) {
$pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);
}
$pdf->Ln();
// Color and font restoration
$pdf->SetFillColor(224, 235, 255);
$pdf->SetTextColor(0);
$pdf->SetFont('');
// Data
$fill = 0;
$i = 0;
foreach($product_items as $product){
$i++;
$pdf->Cell($w[0], 6, $i, 'LR', 0, 'C', $fill);
$pdf->Cell($w[1], 6, $product->getTitle(), 'LR', 0, 'L', $fill);
$pdf->Cell($w[2], 6, $product->getQuantity(), 'LR', 0, 'R', $fill);
$pdf->Cell($w[3], 6, ShopDisplay::priceFormat($product->getPrice(), $shop->getCurrencySymbol()), 'LR', 0, 'R', $fill);
$pdf->Cell($w[4], 6, ShopDisplay::priceFormat($product->getPrice() * $product->getQuantity(), $shop->getCurrencySymbol()), 'LR', 0, 'R', $fill);
$pdf->Ln();
$fill=!$fill;
}
$pdf->Cell(array_sum($w) - $w[4], 6, $lang->total, 1, 0, 'R',$fill);
$pdf->Cell($w[4], 6, ShopDisplay::priceFormat($order->getTotalBeforeDiscount(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
$fill=!$fill;
$pdf->Ln();
if($order->getDiscountAmount()){
$pdf->Cell(array_sum($w) - $w[4], 6, $lang->discount, 1, 0, 'R',$fill);
$pdf->Cell($w[4], 6, ShopDisplay::priceFormat(-1 * $order->getDiscountAmount(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
$fill=!$fill;
$pdf->Ln();
}
if($order->getShippingMethodName()){
$pdf->Cell(array_sum($w) - $w[4], 6, $lang->shipping, 1, 0, 'R',$fill);
$pdf->Cell($w[4], 6, ShopDisplay::priceFormat($order->getShippingCost(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
$fill=!$fill;
$pdf->Ln();
}
$pdf->SetFont('', 'B');
$pdf->Cell(array_sum($w) - $w[4], 6, $lang->grand_total, 1, 0, 'R',$fill);
$pdf->Cell($w[4], 6, ShopDisplay::priceFormat($order->getTotal(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
$fill=!$fill;
$pdf->Ln();
//.........这里部分代码省略.........
示例11:
<td width="336"><p align="center">________________________________________</p>
</td>
<td width="320"><p align="center">________________________________________</p>
</td>
</tr>
<tr>
<td><div align="center">{$Aval1} - {$VarAval1}</div></td>
<td><div align="center">{$Aval2} - {$VarAval2}</div></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<p align="justify">Este pagaré si no fuera pagado a su vencimiento causará INTERESES a razón 1.00% MENSUAL por todo el tiempo que dure insoluto y está sujeto a COBRO ANTICIPADO del saldo al no ser con PUNTUALIDAD cualquier abono especifico en las CONDICIONES DEL CONTRATO.</p>
</div> </td>
</tr>
</table>
EOD;
$pdf->writeHTML($tb12, true, false, false, false, '');
//ºººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººº
$pdf->SetDrawColor(10);
// tamaño
// x x y
$pdf->Rect(10, 40, 190, 90, 'D');
$pdf->SetDrawColor(0);
$pdf->SetDrawColor(10);
// tamaño
// x x y
$pdf->Rect(10, 165, 190, 90, 'D');
$pdf->SetDrawColor(0);
//$pdf->RoundedRect(5, 255, 40, 30, 3.50, '1111', 'DF');
//Close and output PDF document
$pdf->Output('solicitud.pdf', 'I');
示例12: TCPDF
require_once 'tcpdf/tcpdf.php';
// подключаем библиотеку
// создаем объект TCPDF - документ с размерами формата A4
// ориентация - книжная
// единицы измерения - миллиметры
// кодировка - UTF-8
$pdf = new TCPDF('L', 'mm', 'A4', true, 'UTF-8', false);
// убираем на всякий случай шапку и футер документа
// $pdf->setPageOrientation('Landscape'); //setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(20, 25, 25);
// устанавливаем отступы (20 мм - слева, 25 мм - сверху, 25 мм - справа)
// $pdf->SetXY(90, 10);
// устанавливаем координаты вывода текста в рамке:
// 90 мм - отступ от левого края бумаги, 10 мм - от верхнего
$pdf->SetDrawColor(0, 0, 200);
// устанавливаем цвет рамки (синий)
$pdf->SetTextColor(0, 200, 0);
// устанавливаем цвет текста (зеленый)
// set cell padding
$pdf->setCellPaddings(1, 1, 1, 1);
// set cell margins
$pdf->setCellMargins(1, 1, 1, 1);
// set color for background
$pdf->SetFillColor(255, 255, 127);
$_SERVER['HTTP_REFERER'] = ';;;';
// отключаю срабатывание редиректа
require_once "params.php";
if (isset($_REQUEST['table'])) {
$table = $_REQUEST['table'];
} else {
示例13: display
public function display($arraydata, $y_axis = 0, $fielddata = false)
{
//print_r($arraydata);echo "<br/>";
// $this->pdf->Cell(10,10,"SSSS");
$this->Rotate($arraydata["rotation"]);
if ($arraydata["rotation"] != "") {
if ($arraydata["rotation"] == "Left") {
$w = $arraydata["width"];
$arraydata["width"] = $arraydata["height"];
$arraydata["height"] = $w;
$this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY());
} elseif ($arraydata["rotation"] == "Right") {
$w = $arraydata["width"];
$arraydata["width"] = $arraydata["height"];
$arraydata["height"] = $w;
$this->pdf->SetXY($this->pdf->GetX(), $this->pdf->GetY() - $arraydata["height"]);
} elseif ($arraydata["rotation"] == "UpsideDown") {
//soverflow"=>$stretchoverflow,"poverflow"
$arraydata["soverflow"] = true;
$arraydata["poverflow"] = true;
// $w=$arraydata["width"];
// $arraydata["width"]=$arraydata["height"];
//$arraydata["height"]=$w;
$this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY() - $arraydata["height"]);
}
}
if ($arraydata["type"] == "SetFont") {
if ($arraydata["font"] == 'uGB') {
$this->pdf->isUnicode = true;
} else {
$this->pdf->isUnicode = false;
}
$this->pdf->SetFont($arraydata["font"], $arraydata["fontstyle"], $arraydata["fontsize"]);
} elseif ($arraydata["type"] == "subreport") {
$this->runSubReport($arraydata);
} elseif ($arraydata["type"] == "MultiCell") {
$currenty = $this->pdf->GetY();
if ($fielddata == false) {
if ($this->allowprintuntill >= $currenty) {
$this->checkoverflow($arraydata, $this->updatePageNo($arraydata["txt"]));
}
} elseif ($fielddata == true) {
if ($this->allowprintuntill >= $currenty) {
$this->checkoverflow($arraydata, $this->updatePageNo($this->analyse_expression($arraydata["txt"], $arraydata["isPrintRepeatedValues"])));
} elseif ($this->parentcurrentband == "detail") {
$this->pdf->Cell(40, 10, "SADSD");
}
// echo $arraydata["txt"]."+\"|(".$y_axis.",".print_r($arraydata,true)."),$this->allowprintuntill,$newy\"<br/><br/>";
}
} elseif ($arraydata["type"] == "SetXY") {
$this->pdf->SetXY($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis);
} elseif ($arraydata["type"] == "Cell") {
$currenty = $this->pdf->GetY();
if ($this->allowprintuntill >= $currenty) {
$this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->updatePageNo($arraydata["txt"]), $arraydata["border"], $arraydata["ln"], $arraydata["align"], $arraydata["fill"], $arraydata["link"]);
} elseif ($this->parentcurrentband == "detail") {
$this->pdf->Cell(40, 10, "SADSD");
}
} elseif ($arraydata["type"] == "Rect") {
$this->pdf->Rect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
} elseif ($arraydata["type"] == "Image") {
$path = $this->analyse_expression($arraydata["path"]);
$imgtype = substr($path, -3);
if ($imgtype == 'jpg' || right($path, 3) == 'jpg' || right($path, 4) == 'jpeg') {
$imgtype = "JPEG";
} elseif ($imgtype == 'png' || $imgtype == 'PNG') {
$imgtype = "PNG";
}
if (file_exists($path) || left($path, 4) == 'http') {
$this->pdf->Image($path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
} elseif (left($path, 22) == "data:image/jpeg;base64") {
$imgtype = "JPEG";
$img = str_replace('data:image/jpeg;base64,', '', $path);
$imgdata = base64_decode($img);
$this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
//,$imgtype,$arraydata["link"]);
} elseif (left($path, 22) == "data:image/png;base64,") {
$imgtype = "PNG";
// $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$img = str_replace('data:image/png;base64,', '', $path);
$imgdata = base64_decode($img);
$this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
//,$imgtype,$arraydata["link"]);
}
} elseif ($arraydata["type"] == "SetTextColor") {
$this->pdf->SetTextColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "SetDrawColor") {
$this->pdf->SetDrawColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "SetLineWidth") {
$this->pdf->SetLineWidth($arraydata["width"]);
} elseif ($arraydata["type"] == "Line") {
$this->pdf->Line($arraydata["x1"] + $this->arrayPageSetting["leftMargin"], $arraydata["y1"] + $y_axis, $arraydata["x2"] + $this->arrayPageSetting["leftMargin"], $arraydata["y2"] + $y_axis);
} elseif ($arraydata["type"] == "SetFillColor") {
$this->pdf->SetFillColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "lineChart") {
$this->showLineChart($arraydata, $y_axis);
} elseif ($arraydata["type"] == "barChart") {
$this->showBarChart($arraydata, $y_axis, 'barChart');
} elseif ($arraydata["type"] == "stackedBarChart") {
$this->showBarChart($arraydata, $y_axis, 'stackedBarChart');
//.........这里部分代码省略.........
示例14: testPdfOutput
public function testPdfOutput()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 057');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 057', 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 (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.7);
// set color for cell border
$pdf->SetDrawColor(0, 128, 255);
$pdf->setCellHeightRatio(3);
$pdf->SetXY(15, 60);
// text on center
$pdf->Cell(30, 0, 'Top-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'C');
$pdf->Cell(30, 0, 'Center-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'C');
$pdf->Cell(30, 0, 'Bottom-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'C');
$pdf->Cell(30, 0, 'Ascent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'C');
$pdf->Cell(30, 0, 'Baseline-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'C');
$pdf->Cell(30, 0, 'Descent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'C');
$pdf->SetXY(15, 90);
// text on top
$pdf->Cell(30, 0, 'Top-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'T');
$pdf->Cell(30, 0, 'Center-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'T');
$pdf->Cell(30, 0, 'Bottom-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'T');
$pdf->Cell(30, 0, 'Ascent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'T');
$pdf->Cell(30, 0, 'Baseline-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'T');
$pdf->Cell(30, 0, 'Descent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'T');
$pdf->SetXY(15, 120);
// text on bottom
$pdf->Cell(30, 0, 'Top-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'B');
$pdf->Cell(30, 0, 'Center-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'B');
$pdf->Cell(30, 0, 'Bottom-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'B');
$pdf->Cell(30, 0, 'Ascent-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'B');
$pdf->Cell(30, 0, 'Baseline-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'B');
$pdf->Cell(30, 0, 'Descent-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'B');
// draw some reference lines
$linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(255, 0, 0));
$pdf->Line(15, 60, 195, 60, $linestyle);
$pdf->Line(15, 90, 195, 90, $linestyle);
$pdf->Line(15, 120, 195, 120, $linestyle);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Print an image to explain cell measures
$pdf->Image('tests/images/tcpdf_cell.png', 15, 160, 100, 100, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
$legend = 'LEGEND:
X: cell x top-left origin (top-right for RTL)
Y: cell y top-left origin (top-right for RTL)
CW: cell width
CH: cell height
LW: line width
NRL: normal line position
EXT: external line position
INT: internal line position
ML: margin left
MR: margin right
MT: margin top
MB: margin bottom
PL: padding left
PR: padding right
PT: padding top
PB: padding bottom
TW: text width
FA: font ascent
FB: font baseline
FD: font descent';
$pdf->SetFont('helvetica', '', 10);
$pdf->setCellHeightRatio(1.25);
$pdf->MultiCell(0, 0, $legend, 0, 'L', false, 1, 125, 160, true, 0, false, true, 0, 'T', false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// CELL BORDERS
// add a page
$pdf->AddPage();
//.........这里部分代码省略.........
示例15: rekapitulasi_lahan_kecamatan_pdf
public function rekapitulasi_lahan_kecamatan_pdf($tahun, $periode)
{
/// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Dinas PU CKTR Sidoarjo');
$pdf->SetTitle('Rekapitulasi_Lahan_Perkecamatan_Triwulan' . $periode . '_' . $tahun);
$pdf->SetSubject('TCPDF');
$pdf->SetKeywords('TCPDF, PDF');
$pdf->SetHeaderData('sidoardjo.png', 20, 'PEMERINTAH KABUPATEN SIDOARDJO', 'DINAS PEKERJAAN UMUM CIPTA KARYA DAN TATA RUANG', 'REKAPITULASI DATA LAHAN PERUMAHAH / PEMUKIMAN');
$pdf->setFooterData('Triwulan ' . $periode . ' Tahun ' . $tahun);
$pdf->setBarcode(date('Y-m-d H:i:s'));
// 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 (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', 20);
// add a page
$pdf->AddPage('L', 'A3');
// $pdf->Write(0, 'PEMBANGUNAN PERUMAHAN / PEMUKIMAN', '', 0, 'C', true, 0, false, false, 0);
// $pdf->Write(0, 'REKAPITULASI DATA LAHAN PERUMAHAH / PEMUKIMAN', '', 0, 'C', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
// $pdf->Write(0, 'Tahun :' .$tahun, '', 0, 'L', true, 0, false, false, 0);
// $pdf->Write(0, 'Periode : Triwulan' .$periode, '', 0, 'L', true, 0, false, false, 0);
$pdf->SetLineWidth(5);
$pdf->SetDrawColor(0, 128, 255);
$pdf->SetFillColor(255, 255, 128);
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
$k['JML_IJIN_LOKASI'] = $k['LUAS'] = $k['RENCANA_TAPAK'] = $k['PEMBEBASAN'] = $k['TERBANGUN'] = $k['BELUM_TERBANGUN'] = $k['DIALOKASIKAN'] = $k['PEMBEBASAN'] = $k['DIMATANGKAN'] = $k['AKTIF_DLM_PEMBANGUNAN'] = $k['AKTIF_BERHENTI'] = $k['AKTIF_SDH_SELESAI'] = $k['TIDAK_AKTIF'] = 0;
$tb = "";
$this->load->model('m_report');
$nilai = $this->m_report->jumlah_kecamatan();
foreach ($nilai as $nil) {
$jmlkec = $nil['JUMLAH'];
$data['jumlah'] = $nil['JUMLAH'];
}
for ($j = 1; $j <= $jmlkec; $j++) {
$data['lah_kec'][$j] = $this->m_report->tabel_lahan_kecamatan_all($j, $tahun, $periode);
$data['aktifpemb'][$j] = $this->m_report->aktif_dalam_pembangunan($j, $tahun, $periode);
$data['aktifber'][$j] = $this->m_report->aktif_berhenti($j, $tahun, $periode);
$data['aktifsel'][$j] = $this->m_report->aktif_sdh_selesai($j, $tahun, $periode);
$data['tdkaktif'][$j] = $this->m_report->tidak_aktif($j, $tahun, $periode);
}
for ($c = 1; $c < $jmlkec; $c++) {
foreach ($data['lah_kec'][$c] as $i) {
$tb .= "<tr>\n <td width=\"28px\">" . $c . "</td>\n <td width=\"100px\">" . $i['NAMA_KECAMATAN'] . "</td> \n <td width=\"87px\">" . $i['JML_IJIN_LOKASI'] . " </td>\n <td width=\"87px\">" . $i['LUAS'] . " </td>\n <td width=\"87px\">" . $i['RENCANA_TAPAK'] . " </td>\n <td width=\"90px\">" . $i['PEMBEBASAN'] . " </td>\n <td width=\"87px\">" . $i['TERBANGUN'] . " </td>\n <td width=\"87px\">" . $i['BELUM_TERBANGUN'] . " </td>\n <td width=\"90px\">" . $i['DIALOKASIKAN'] . " </td>\n <td width=\"90px\">" . $i['PEMBEBASAN'] . " </td>\n <td width=\"87px\">" . $i['DIMATANGKAN'] . " </td>";
$k['JML_IJIN_LOKASI'] += $i['JML_IJIN_LOKASI'];
$k['LUAS'] += $i['LUAS'];
$k['RENCANA_TAPAK'] += $i['RENCANA_TAPAK'];
$k['PEMBEBASAN'] += $i['PEMBEBASAN'];
$k['TERBANGUN'] += $i['TERBANGUN'];
$k['BELUM_TERBANGUN'] += $i['BELUM_TERBANGUN'];
$k['DIALOKASIKAN'] += $i['DIALOKASIKAN'];
$k['PEMBEBASAN'] += $i['PEMBEBASAN'];
$k['DIMATANGKAN'] += $i['DIMATANGKAN'];
}
foreach ($data['aktifpemb'][$c] as $i) {
$tb .= "<td width=\"87px\">" . $i['AKTIF_DLM_PEMBANGUNAN'] . "</td>";
$k['AKTIF_DLM_PEMBANGUNAN'] += $i['AKTIF_DLM_PEMBANGUNAN'];
}
foreach ($data['aktifber'][$c] as $i) {
$tb .= "<td width=\"87px\">" . $i['AKTIF_BERHENTI'] . " </td>";
$k['AKTIF_BERHENTI'] += $i['AKTIF_BERHENTI'];
}
foreach ($data['aktifsel'][$c] as $i) {
$tb .= "<td width=\"87px\">" . $i['AKTIF_SDH_SELESAI'] . " </td>";
$k['AKTIF_SDH_SELESAI'] += $i['AKTIF_SDH_SELESAI'];
}
foreach ($data['tdkaktif'][$c] as $i) {
$tb .= "<td width=\"87px\">" . $i['TIDAK_AKTIF'] . " </td> \n </tr> ";
$k['TIDAK_AKTIF'] += $i['TIDAK_AKTIF'];
}
}
$tb1 = "";
$tb1 .= "<tr>\n \n <td width=\"130px\">JUMLAH</td>\n <td width=\"87px\">" . $k['JML_IJIN_LOKASI'] . " </td>\n <td width=\"87px\">" . $k['LUAS'] . " </td>\n <td width=\"87px\">" . $k['RENCANA_TAPAK'] . " </td>\n <td width=\"90px\">" . $k['PEMBEBASAN'] . " </td>\n <td width=\"87px\">" . $k['TERBANGUN'] . " </td>\n <td width=\"87px\">" . $k['BELUM_TERBANGUN'] . " </td>\n <td width=\"90px\">" . $k['DIALOKASIKAN'] . " </td>\n <td width=\"90px\">" . $k['PEMBEBASAN'] . " </td>\n <td width=\"87px\">" . $k['DIMATANGKAN'] . " </td>\n <td width=\"87px\">" . $k['AKTIF_DLM_PEMBANGUNAN'] . " </td>\n <td width=\"87px\">" . $k['AKTIF_BERHENTI'] . " </td>\n <td width=\"87px\">" . $k['AKTIF_SDH_SELESAI'] . " </td>\n <td width=\"87px\">" . $k['TIDAK_AKTIF'] . " </td>\n \n </tr> ";
$tbl = <<<EOD
<table border="1" cellpadding="2" cellspacing="2">
<thead>
<tr style="background-color:#FFFF00;color:#0000FF;">
<td width="28px" align="center"><b>NO</b></td>
<td width="100px" align="center"><b>Kecamatan</b></td>
<td width="87px " align="center"> <b>Perusahaan</b></td>
//.........这里部分代码省略.........