本文整理匯總了PHP中TCPDF::Rect方法的典型用法代碼示例。如果您正苦於以下問題:PHP TCPDF::Rect方法的具體用法?PHP TCPDF::Rect怎麽用?PHP TCPDF::Rect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TCPDF
的用法示例。
在下文中一共展示了TCPDF::Rect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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 012');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// disable header and footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// 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(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', '', 10);
// add a page
$pdf->AddPage();
$style = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,20,5,10', 'phase' => 10, 'color' => array(255, 0, 0));
$style2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0));
$style3 = array('width' => 1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,10', 'color' => array(255, 0, 0));
$style4 = array('L' => 0, 'T' => array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => '20,10', 'phase' => 10, 'color' => array(100, 100, 255)), 'R' => array('width' => 0.5, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => array(50, 50, 127)), 'B' => array('width' => 0.75, 'cap' => 'square', 'join' => 'miter', 'dash' => '30,10,5,10'));
$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));
//.........這裏部分代碼省略.........
示例2: 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 009');
$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 . ' 009', 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);
// -------------------------------------------------------------------
// add a page
$pdf->AddPage();
// set JPEG quality
$pdf->setJPEGQuality(75);
// Image method signature:
// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Example of Image from data stream ('PHP rules')
$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
// The '@' character is used to indicate that follows an image data stream and not an image file name
$pdf->Image('@' . $imgdata);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Image example with resizing
$pdf->Image('./tests/images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test fitbox with all alignment combinations
$horizontal_alignments = array('L', 'C', 'R');
$vertical_alignments = array('T', 'M', 'B');
$x = 15;
$y = 35;
$w = 30;
$h = 30;
// test all combinations of alignments
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i] . ' ';
$x = 15;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 128));
$pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 32;
// new column
}
$y += 32;
// new row
}
$x = 115;
$y = 35;
$w = 25;
$h = 50;
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i] . ' ';
$x = 115;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
$pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 27;
// new column
}
$y += 52;
// new row
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Stretching, position and alignment example
$pdf->SetXY(110, 200);
$pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
$pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
$this->comparePdfs($pdf);
}
示例3: array
/**
* Draws a filled rectangle at x1,y1 with width w and height h
*
* See {@link Style::munge_color()} for the format of the color array.
*
* @param float $x1
* @param float $y1
* @param float $w
* @param float $h
* @param array $color
*/
function filled_rectangle($x1, $y1, $w, $h, $color, $blend = "Normal", $opacity = 1.0)
{
//var_dump($color);
dompdf_debug("trace", "({$x1}, {$y1}, {$w}, {$h}, [{$color['0']}, {$color['1']}, {$color['2']}], {$blend}, {$opacity})");
//$this->_set_stroke_color($color);
//$this->_set_fill_color($color);
//$this->_set_line_style(1, "square", "miter", array());
$this->_set_line_transparency($blend, $opacity);
$this->_set_fill_transparency($blend, $opacity);
$this->_pdf->Rect($x1, $y1, $w, $h, 'F', $this->_make_line_style($color, 1, "square", "miter", array()), $this->_get_rgb($color));
//***
}
示例4: date
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 10);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setFontSubsetting(true);
$pdf->SetFont('', 'B', 16, '', true);
$pdf->SetTitle("Mapsurveys (K) LTD. - Payslip");
$id = $employee->id;
$basic = $employee->basic_pay;
$pdf->AddPage();
$pdf->setColor('fill', 220, 220, 220);
$pdf->Cell(130, 0, 'SALARY VOUCHER', 0, 1, 'C', true);
$pdf->SetFont('', 'B', 10);
$pdf->Ln(9);
$pdf->Rect(15, 40, 130, 150);
$dateObj = DateTime::createFromFormat("!m", $month);
$pdf->Cell(50, 0, "Mapsurveys (K) Limited");
$pdf->Cell(40, 0, "Month of Pay:");
$pdf->SetFont('');
$pdf->Cell(40, 0, $monthName = $dateObj->format('F'));
$pdf->SetFont('', 'B');
$pdf->Ln(10);
$pdf->Cell(15, 0, "Name:");
$pdf->SetFont('');
$pdf->Cell(35, 0, $employee->fname[0] . "." . $employee->mname[0] . ". " . $employee->lname);
$pdf->SetFont('', 'B');
$pdf->Cell(40, 0, "Date Paid:");
$pdf->SetFont('');
$pdf->Cell(40, 0, date("d-M-Y"));
$pdf->Ln(6);
示例5: array
/**
* Draws a filled rectangle at x1,y1 with width w and height h
*
* See {@link Style::munge_color()} for the format of the color array.
*
* @param float $x1
* @param float $y1
* @param float $w
* @param float $h
* @param array $color
*/
function filled_rectangle($x1, $y1, $w, $h, $color, $blend = "Normal", $opacity = 1.0)
{
//var_dump($color);
//dompdf_debug("trace", "($x1, $y1, $w, $h, [$color[0], $color[1], $color[2]], $blend, $opacity)");
//$this->_set_stroke_color($color);
//$this->_set_fill_color($color);
//$this->_set_line_style(1, "square", "miter", array());
$this->_set_line_transparency($blend, $opacity);
$this->_set_fill_transparency($blend, $opacity);
$this->_pdf->Rect($x1, $y1, $w, $h, 'F', $this->_make_line_style($color, 1, "square", "miter", array()), $this->_get_rgb($color));
//***
}
示例6:
$pdf->MultiCell(40, 5, "D test multicell line 1\ntest multicell line 2\ntest multicell line 3", 1, 'J', 0, 2);
$pdf->MultiCell(40, 5, "E test multicell line 1\ntest multicell line 2\ntest multicell line 3", 1, 'L', 0, 1);
$pdf->MultiCell(40, 5, "F test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line\nF test multicell line", 1, 'L', 0, 1);
// reset pointer to the last page
$pdf->lastPage();
// --- START GRAPHIC TRANFORMATIONS TEST -------------------
// Code Provided by Moritz Wagner and Andreas Würmser
$pdf->setPrintHeader(false);
$pdf->AddPage();
$pdf->Bookmark('Transformations', 0, 0);
$pdf->setPrintFooter(false);
//Scaling
$pdf->Bookmark('Scaling', 1, 4);
$pdf->SetDrawColor(200);
$pdf->SetTextColor(200);
$pdf->Rect(50, 20, 40, 10, 'D');
$pdf->Text(50, 19, 'Scale');
$pdf->SetDrawColor(0);
$pdf->SetTextColor(0);
//Start Transformation
$pdf->StartTransform();
//Scale by 150% centered by (50,30) which is the lower left corner of the rectangle
$pdf->ScaleXY(150, 50, 30);
$pdf->Rect(50, 20, 40, 10, 'D');
$pdf->Text(50, 19, 'Scale');
//Stop Transformation
$pdf->StopTransform();
//Translation
$pdf->Bookmark('Translation', 1, 14);
$pdf->SetDrawColor(200);
$pdf->SetTextColor(200);
示例7:
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'BI', 8);
// add a page
$pdf->AddPage();
/*
* 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(1.5);
// draw opaque red square
$pdf->SetFillColor(255, 0, 0);
$pdf->Rect(30, 60, 40, 40, 'DF');
// set alpha to semi-transparency
$pdf->SetAlpha(0.5);
// draw green square
$pdf->SetFillColor(0, 255, 0);
$pdf->Rect(40, 70, 40, 40, 'DF');
// draw jpeg image
$pdf->Image('../images/image_demo.jpg', 50, 80, 40, 40, '', 'http://www.tcpdf.org', '', true, 72);
// restore full opacity
$pdf->SetAlpha(1);
// print name
$pdf->Text(55, 85, 'TRANSPARENCY');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_025.pdf', 'I');
//============================================================+
示例8:
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
//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', '', 10);
// add a page
$pdf->AddPage();
//Scaling
$pdf->SetDrawColor(200);
$pdf->SetTextColor(200);
$pdf->Rect(50, 20, 40, 10, 'D');
$pdf->Text(50, 19, 'Scale');
$pdf->SetDrawColor(0);
$pdf->SetTextColor(0);
//Start Transformation
$pdf->StartTransform();
//Scale by 150% centered by (50,30) which is the lower left corner of the rectangle
$pdf->ScaleXY(150, 50, 30);
$pdf->Rect(50, 20, 40, 10, 'D');
$pdf->Text(50, 19, 'Scale');
//Stop Transformation
$pdf->StopTransform();
//Translation
$pdf->SetDrawColor(200);
$pdf->SetTextColor(200);
$pdf->Rect(125, 20, 40, 10, 'D');
示例9: substr
else $cfpiva = '';
//formatto le date
$scadenza = substr($effetto['scaden'],8,2).'-'.substr($effetto['scaden'],5,2).'-'.substr($effetto['scaden'],0,4);
$datafatt = substr($effetto['datfat'],8,2).'-'.substr($effetto['datfat'],5,2).'-'.substr($effetto['datfat'],0,4);
if ($numefftot == 3)
{
$pdf->AddPage();
$numefftot = 0;
}
//a secondo del tipo di effetto stampo il relativo modulo
switch($effetto['tipeff'])
{
//questo è il modulo delle ricevute bancarie
case "B":
$pdf->SetFont('helvetica','',7);
$pdf->Rect(5,5+$passo*$numefftot,200,50);
$pdf->Rect(5,60+$passo*$numefftot,65,30);
$pdf->Rect(71,60+$passo*$numefftot,85,30);
$pdf->Rect(157,60+$passo*$numefftot,48,30);
$pdf->Rect(75,20+$passo*$numefftot,125,10,'DF');
$pdf->SetY(30+$numefftot*$passo);
$pdf->Image('@'.$logo,6,6+$passo*$numefftot,30,0);
$pdf->Cell(50,3,$admin_aziend['ragso1'],0,2,'L');
$pdf->Cell(50,3,$admin_aziend['ragso2'],0,2,'L');
$pdf->Cell(50,3,$admin_aziend['indspe'].' Tel.'.$admin_aziend['telefo'],0,2,'L');
$pdf->Cell(50,3,$admin_aziend['capspe'].' '.$admin_aziend['citspe'].' ('.$admin_aziend['prospe'].')',0,2,'L');
$pdf->Cell(50,3,'P.I. '.$admin_aziend['pariva'],0,2,'L');
$pdf->Cell(50,3,'C.F. '.$admin_aziend['codfis'],0,0,'L');
$pdf->SetXY(70,5+$numefftot*$passo);
$pdf->SetFont('helvetica','B',10);
$pdf->Cell(50,10,'RICEVUTA N. '.$effetto['progre'],0,0,'L');
示例10: array
// check also the following methods:
// SetDrawColorArray()
// SetFillColorArray()
// SetTextColorArray()
// set font
$pdf->SetFont('helvetica', 'B', 18);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of CMYK, RGB and Grayscale colours', '', 0, 'L', true, 0, false, false, 0);
// define style for border
$border_style = array('all' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'phase' => 0));
// --- CMYK ------------------------------------------------
$pdf->SetDrawColor(50, 0, 0, 0);
$pdf->SetFillColor(100, 0, 0, 0);
$pdf->SetTextColor(100, 0, 0, 0);
$pdf->Rect(30, 60, 30, 30, 'DF', $border_style);
$pdf->Text(30, 92, 'Cyan');
$pdf->SetDrawColor(0, 50, 0, 0);
$pdf->SetFillColor(0, 100, 0, 0);
$pdf->SetTextColor(0, 100, 0, 0);
$pdf->Rect(70, 60, 30, 30, 'DF', $border_style);
$pdf->Text(70, 92, 'Magenta');
$pdf->SetDrawColor(0, 0, 50, 0);
$pdf->SetFillColor(0, 0, 100, 0);
$pdf->SetTextColor(0, 0, 100, 0);
$pdf->Rect(110, 60, 30, 30, 'DF', $border_style);
$pdf->Text(110, 92, 'Yellow');
$pdf->SetDrawColor(0, 0, 0, 50);
$pdf->SetFillColor(0, 0, 0, 100);
$pdf->SetTextColor(0, 0, 0, 100);
$pdf->Rect(150, 60, 30, 30, 'DF', $border_style);
示例11:
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0);
// set font
$pdf->SetFont('helvetica', '', 10);
// --- Scaling ---------------------------------------------
$pdf->SetDrawColor(200);
$pdf->SetTextColor(200);
$pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 66, 'Scale');
$pdf->SetDrawColor(0);
$pdf->SetTextColor(0);
// Start Transformation
$pdf->StartTransform();
// Scale by 150% centered by (50,80) which is the lower left corner of the rectangle
$pdf->ScaleXY(150, 50, 80);
$pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 66, 'Scale');
// Stop Transformation
$pdf->StopTransform();
// --- Translation -----------------------------------------
$pdf->SetDrawColor(200);
$pdf->SetTextColor(200);
$pdf->Rect(125, 70, 40, 10, 'D');
示例12: array
$pdf->SetFont("helvetica", "", 10);
$style = array("width" => 0.5, "cap" => "butt", "join" => "miter", "dash" => "10,20,5,10", "phase" => 10, "color" => array(255, 0, 0));
$style2 = array("width" => 0.5, "cap" => "butt", "join" => "miter", "dash" => 0, "color" => array(255, 0, 0));
$style3 = array("width" => 1, "cap" => "round", "join" => "round", "dash" => "2,10", "color" => array(255, 0, 0));
$style4 = array("L" => 0, "T" => array("width" => 0.25, "cap" => "butt", "join" => "miter", "dash" => "20,10", "phase" => 10, "color" => array(100, 100, 255)), "R" => array("width" => 0.5, "cap" => "round", "join" => "miter", "dash" => 0, "color" => array(50, 50, 127)), "B" => array("width" => 0.75, "cap" => "square", "join" => "miter", "dash" => "30,10,5,10"));
$style5 = array("width" => 0.25, "cap" => "butt", "join" => "miter", "dash" => 0, "color" => array(0, 0, 0));
$style6 = array("width" => 0.5, "cap" => "butt", "join" => "miter", "dash" => "10,10", "color" => array(0, 255, 0));
$style7 = array("width" => 0.5, "cap" => "butt", "join" => "miter", "dash" => 0, "color" => array(200, 200, 0));
// Line
$pdf->Text(5, 7, "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, 7, "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, 37, "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, 82, "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, 105, 40, 20);
示例13: foreach
case 'angle':
$pdf->Rotate(-$value, $left, $top);
break;
case 'fill_r':
$r = $value;
break;
case 'fill_g':
$g = $value;
break;
case 'fill_b':
$b = $value;
break;
}
}
$pdf->SetFillColor($r, $g, $b);
$pdf->Rect($left, $top, $width, $height, 'F');
}
if ($objects[$i]["type"] == "path") {
foreach ($objects[$i] as $key => $value) {
switch ($key) {
case 'top':
$top = $value;
break;
case 'left':
$left = $value;
break;
case 'height':
$height = $value;
break;
case 'width':
$width = $value;
示例14:
//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', "B", 12);
// add a page
$pdf->AddPage();
$pdf->SetLineWidth(1);
$pdf->SetDrawColor(50, 0, 0, 0);
$pdf->SetFillColor(100, 0, 0, 0);
$pdf->SetTextColor(100, 0, 0, 0);
$pdf->Rect(30, 60, 20, 20, 'DF');
$pdf->Text(30, 85, 'Cyan');
$pdf->SetDrawColor(0, 50, 0, 0);
$pdf->SetFillColor(0, 100, 0, 0);
$pdf->SetTextColor(0, 100, 0, 0);
$pdf->Rect(60, 60, 20, 20, 'DF');
$pdf->Text(60, 85, 'Magenta');
$pdf->SetDrawColor(0, 0, 50, 0);
$pdf->SetFillColor(0, 0, 100, 0);
$pdf->SetTextColor(0, 0, 100, 0);
$pdf->Rect(90, 60, 20, 20, 'DF');
$pdf->Text(90, 85, 'Yellow');
$pdf->SetDrawColor(0, 0, 0, 50);
$pdf->SetFillColor(0, 0, 0, 100);
$pdf->SetTextColor(0, 0, 0, 100);
$pdf->Rect(120, 60, 20, 20, 'DF');
示例15:
<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');