本文整理汇总了PHP中TCPDF::SetLineStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::SetLineStyle方法的具体用法?PHP TCPDF::SetLineStyle怎么用?PHP TCPDF::SetLineStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::SetLineStyle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 035');
$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 . ' 035', 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('times', 'BI', 16);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of SetLineStyle() method', '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln();
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(255, 0, 0)));
$pdf->SetFillColor(255, 255, 128);
$pdf->SetTextColor(0, 0, 128);
$text = "DUMMY";
$pdf->Cell(0, 0, $text, 1, 1, 'L', 1, 0);
$pdf->Ln();
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255)));
$pdf->SetFillColor(255, 255, 0);
$pdf->SetTextColor(0, 0, 255);
$pdf->MultiCell(60, 4, $text, 1, 'C', 1, 0);
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 0)));
$pdf->SetFillColor(0, 0, 255);
$pdf->SetTextColor(255, 255, 0);
$pdf->MultiCell(60, 4, $text, 'TB', 'C', 1, 0);
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255)));
$pdf->SetFillColor(0, 255, 0);
$pdf->SetTextColor(255, 0, 255);
$pdf->MultiCell(60, 4, $text, 1, 'C', 1, 1);
$this->comparePdfs($pdf);
}
示例3: array
$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('times', 'BI', 16);
// add a page
$pdf->AddPage();
// print a line using Cell()
$pdf->Cell(0, 12, 'Example 035', 1, 1, 'C');
$pdf->Ln();
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(255, 0, 0)));
$pdf->SetFillColor(255, 255, 128);
$pdf->SetTextColor(0, 0, 128);
$text = "DUMMY";
$pdf->Cell(0, 0, $text, 1, 1, 'L', 1, 0);
$pdf->Ln();
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255)));
$pdf->SetFillColor(255, 255, 0);
$pdf->SetTextColor(0, 0, 255);
$pdf->MultiCell(60, 4, $text, 1, 'C', 1, 0);
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 0)));
$pdf->SetFillColor(0, 0, 255);
$pdf->SetTextColor(255, 255, 0);
$pdf->MultiCell(60, 4, $text, 'TB', 'C', 1, 0);
$pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255)));
$pdf->SetFillColor(0, 255, 0);
示例4:
$pdf->SetTextColor(0, 0, 0);
//set up a page
$pdf->AddPage();
$pdf->SetDisplayMode('real');
$pdf->SetFontSize(8);
// ширина квитанции
$width = 190;
// Высота половинки
$height = 75;
// ширина слушебного поля
$field_width = 80;
// Начальные координаты
$x = 10;
$y = 10;
// Первая рамка
$pdf->SetLineStyle(array('dash' => 2));
$pdf->SetXY($x, $y);
$pdf->Cell($width, $height, '', 1, 0, 'C', 0);
$pdf->SetXY($field_width + $x - 40, $y + 5);
$pdf->Write(5, "Извещение" . PHP_EOL);
$pdf->SetXY($x + 10, $height + $y - 10);
//Some test
$pdf->Write(5, "Кассир" . PHP_EOL);
$pdf->SetXY($field_width, $y);
$pdf->Cell($width - $field_width, $height, '', 'L', 0, 'C', 0);
// Наименование
$x = $field_width;
textfield($pdf, $x + 2, $y + 3, 110, $recipient, '(наименование получателя платежа)');
// Инн получателя
$y += 8;
textfield($pdf, $x + 2, $y + 3, 35, $inn, '(ИНН получателя платежа)');
示例5: array
$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);
$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, 105, 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, 132, "Polygon examples");
$pdf->SetLineStyle(array("width" => 0.5, "cap" => "butt", "join" => "miter", "dash" => 0, "color" => array(0, 0, 0)));
示例6: array
$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)));
示例7: array
$grid_x = $X_offset + $box_width + $X_spacing + $wall_thickness;
$pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
$grid_y += ($box_height + $Y_spacing) * 2;
$pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
$grid_y = $Y_offset + $wall_thickness + $Y_spacing + $box_height;
$grid_x = $X_offset + $wall_thickness;
$pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
$grid_x += $box_width + $X_spacing;
$pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
$grid_x += $box_width + $X_spacing;
$pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
$grid_x += $box_width + $X_spacing;
$pdf->rect($grid_x, $grid_y, $box_inner_width, $box_inner_height);
}
// draw top and bottom
$pdf->SetLineStyle($shape_style);
shift_points($points_lid, $box_width + $X_spacing + $X_offset, $Y_offset);
$pdf->Polygon($points_lid, '', $shape_style, array(), true);
// true denotes a closed polygon, very important
shift_points($points_lid, 0, ($box_height + $Y_spacing) * 2);
$pdf->Polygon($points_lid, '', $shape_style, array(), true);
// draw four sides
shift_points($points_side, $X_offset, $box_height + $Y_spacing + $Y_offset);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
shift_points($points_side, $box_width + $X_spacing, 0);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
shift_points($points_side, $box_width + $X_spacing, 0);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
shift_points($points_side, $box_width + $X_spacing, 0);
$pdf->Polygon($points_side, '', $shape_style, array(), true);
// ---------------------------------------------------------
示例8: RenderAsPDF
public function RenderAsPDF(TCPDF $oPdf, DisplayableGraph $oGraph, $fScale, $aContextDefs)
{
$bReached = $this->GetProperty('is_reached');
$oPdf->SetFillColor(255, 255, 255);
if ($bReached) {
$aBorderColor = array(100, 100, 100);
} else {
$aBorderColor = array(200, 200, 200);
}
$oPdf->SetLineStyle(array('width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => $aBorderColor));
$sIconUrl = $this->GetProperty('icon_url');
$sIconPath = str_replace(utils::GetAbsoluteUrlModulesRoot(), APPROOT . 'env-' . utils::GetCurrentEnvironment() . '/', $sIconUrl);
$oPdf->SetAlpha(1);
$oPdf->Circle($this->x * $fScale, $this->y * $fScale, $this->GetWidth() / 2 * $fScale, 0, 360, 'DF');
if ($bReached) {
$oPdf->SetAlpha(1);
} else {
$oPdf->SetAlpha(0.4);
}
$oPdf->Image($sIconPath, ($this->x - 17) * $fScale, ($this->y - 17) * $fScale, 16 * $fScale, 16 * $fScale);
$oPdf->Image($sIconPath, ($this->x + 1) * $fScale, ($this->y - 17) * $fScale, 16 * $fScale, 16 * $fScale);
$oPdf->Image($sIconPath, ($this->x - 8) * $fScale, ($this->y + 1) * $fScale, 16 * $fScale, 16 * $fScale);
$oPdf->SetFont('dejavusans', '', 24 * $fScale, '', true);
$width = $oPdf->GetStringWidth($this->GetProperty('label'));
$oPdf->SetTextColor(0, 0, 0);
$oPdf->Text($this->x * $fScale - $width / 2, ($this->y + 25) * $fScale, $this->GetProperty('label'));
}
示例9: testPdfOutput
//.........这里部分代码省略.........
$pdf->AddPage();
// IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
$pdf->Cell(0, 0, 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200', 0, 1);
$pdf->write1DBarcode('01234567094987654321-01234567891', 'IMB', '', '', '', 15, 0.6, $style, 'N');
$pdf->Ln();
// POSTNET
$pdf->Cell(0, 0, 'POSTNET', 0, 1);
$pdf->write1DBarcode('98000', 'POSTNET', '', '', '', 15, 0.6, $style, 'N');
$pdf->Ln();
// PLANET
$pdf->Cell(0, 0, 'PLANET', 0, 1);
$pdf->write1DBarcode('98000', 'PLANET', '', '', '', 15, 0.6, $style, 'N');
$pdf->Ln();
// RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
$pdf->Cell(0, 0, 'RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)', 0, 1);
$pdf->write1DBarcode('SN34RD1A', 'RMS4CC', '', '', '', 15, 0.6, $style, 'N');
$pdf->Ln();
// KIX (Klant index - Customer index)
$pdf->Cell(0, 0, 'KIX (Klant index - Customer index)', 0, 1);
$pdf->write1DBarcode('SN34RDX1A', 'KIX', '', '', '', 15, 0.6, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TEST BARCODE ALIGNMENTS
// add a page
$pdf->AddPage();
// set a background color
$style['bgcolor'] = array(255, 255, 240);
$style['fgcolor'] = array(127, 0, 0);
// Left position
$style['position'] = 'L';
$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Center position
$style['position'] = 'C';
$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Right position
$style['position'] = 'R';
$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
$style['fgcolor'] = array(0, 127, 0);
$style['position'] = '';
$style['stretch'] = false;
// disable stretch
$style['fitwidth'] = false;
// disable fitwidth
// Left alignment
$style['align'] = 'L';
$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Center alignment
$style['align'] = 'C';
$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Right alignment
$style['align'] = 'R';
$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
$style['fgcolor'] = array(0, 64, 127);
$style['position'] = '';
$style['stretch'] = false;
// disable stretch
$style['fitwidth'] = true;
// disable fitwidth
// Left alignment
$style['cellfitalign'] = 'L';
$pdf->write1DBarcode('LEFT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Center alignment
$style['cellfitalign'] = 'C';
$pdf->write1DBarcode('CENTER', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Right alignment
$style['cellfitalign'] = 'R';
$pdf->write1DBarcode('RIGHT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
$pdf->Ln(2);
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
$style['fgcolor'] = array(127, 0, 127);
// Left alignment
$style['position'] = 'L';
$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Center alignment
$style['position'] = 'C';
$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
$pdf->Ln(2);
// Right alignment
$style['position'] = 'R';
$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TEST BARCODE STYLE
// define barcode style
$style = array('position' => '', 'align' => '', 'stretch' => true, 'fitwidth' => false, 'cellfitalign' => '', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 128), 'bgcolor' => array(255, 255, 128), 'text' => true, 'label' => 'CUSTOM LABEL', 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
// CODE 39 EXTENDED + CHECKSUM
$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1);
$pdf->SetLineStyle(array('width' => 1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)));
$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 120, 25, 0.4, $style, 'N');
$this->comparePdfs($pdf);
}
示例10: render
//.........这里部分代码省略.........
$columns['d'][$k2]['w'] = $new_width;
}
}
}
$flag_first_row = false;
// columns
foreach ($all_columns as $k20 => $v20) {
$x = 5;
foreach ($columns['d'] as $k10 => $v10) {
foreach (array('v', 'c', 'a', 'b', 's', 't', 'u') as $v30) {
if (isset($v20['d'][$k10][$v30])) {
$v10[$v30] = $v20['d'][$k10][$v30];
}
}
$new_width = @$v10['w'];
if (!empty($v10['c'])) {
// we need to get width of next elements
for ($i = $k10 + 1; $i < $k10 + $v10['c']; $i++) {
$new_width += $columns['d'][$k10]['w'];
}
}
$align = str_replace(array('left', 'right', 'center'), array('L', 'R', 'C'), @$v10['a']);
if (empty($align)) {
$align = 'L';
}
if (@$v10['b']) {
$pdf->SetFont($this->header['pdf']['font']['family'], 'B', $this->header['pdf']['font']['size']);
} else {
$pdf->SetFont($this->header['pdf']['font']['family'], '', $this->header['pdf']['font']['size']);
}
$pdf->MultiCell($new_width, 5, @$v10['v'], $this->flag_pdf_show_borders, $align, 1, 0, $x, $page_y, true, 0, false, true, 10, 'T');
// underline
if (@$v10['u']) {
$pdf->SetLineStyle(array('width' => 0, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->Line($x, $page_y + 5, $x + @$v10['w'], $page_y + 5);
}
$x += @$v10['w'];
}
$page_y += 5;
}
}
$pdf->SetFont($this->header['pdf']['font']['family'], '', $this->header['pdf']['font']['size']);
$x = 5;
foreach ($columns['d'] as $k10 => $v10) {
// we do do render cells if no data
if (isset($v['d'][$k10]['v'])) {
$align = str_replace(array('left', 'right', 'center'), array('L', 'R', 'C'), @$v['d'][$k10]['a']);
if (empty($align)) {
$align = 'L';
}
if (@$v['d'][$k10]['b']) {
$pdf->SetFont($this->header['pdf']['font']['family'], 'B', $this->header['pdf']['font']['size']);
} else {
$pdf->SetFont($this->header['pdf']['font']['family'], '', $this->header['pdf']['font']['size']);
}
// if we override width
$width = $v10['w'];
if (isset($v['d'][$k10]['w'])) {
$width = $v['d'][$k10]['w'];
} else {
if (isset($v['d'][$k10]['c'])) {
// colspan
// we need to get width of next elements
for ($i = $k10 + 1; $i < $k10 + $v['d'][$k10]['c']; $i++) {
$width += @$columns['d'][$i]['w'];
}
示例11: pdf_nine
/**
* 图文混排
* @author zhaoning <zhaoning@leju.com>
*/
function pdf_nine()
{
// Include the main TCPDF library (search for installation path).
require_once 'tcpdf.php';
// 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 064');
$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 . ' 064', 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)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 8);
// define some html content for testing
$txt = '<p style="text-align:justify;color:blue;font-size:12pt;"><span style="color:red;font-size:14pt;font-weight:bold;">TEST PAGE REGIONS:</span> <span style="color:green;">A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment. You can set multiple regions for the same page. You can combine several adjacent regions to approximate curved shapes.</span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.
Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. <img src="examples/images/image_demo.jpg" width="5mm" height="5mm" /> Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.
Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.
Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.</p>';
// add a page
$pdf->AddPage();
// print some graphic content
$pdf->Image('examples/images/image_demo.jpg', 155, 30, 40, 40, 'JPG', '', '', true);
$pdf->Image('examples/images/image_demo.jpg', 15, 230, 40, 40, 'JPG', '', '', true);
// define some graphic styles
$styleA = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0));
$styleB = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 3, 'color' => array(127, 127, 127));
$pdf->SetFillColor(220, 255, 220);
// write a trapezoid with some information about no-write page regions
$pdf->Polygon(array(15, 90, 57, 90, 67, 140, 15, 140), 'DF', array($styleB, $styleA, $styleB, $styleB));
$pdf->SetXY(15, 90);
$pdf->Cell(42, 0, 'xt111,yt', 0, 0, 'R', false, '', 0, false, 'T', 'T');
$pdf->SetXY(15, 140);
$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'R', false, '', 0, false, 'B', 'B');
$pdf->SetXY(15, 115);
$pdf->Cell(40, 0, 'side', 0, 0, 'R', false, '', 0, false, 'B', 'B');
$pdf->SetLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->Arrow(60, 115, 35, 115, 2, 5, 15);
// write a trapezoid with some information about no-write page regions
$pdf->Polygon(array(145, 130, 195, 130, 195, 180, 155, 180), 'DF', array($styleB, $styleB, $styleB, $styleA));
$pdf->SetXY(145, 130);
$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'L', false, '', 0, false, 'T', 'T');
$pdf->SetXY(155, 180);
$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'L', false, '', 0, false, 'B', 'B');
$pdf->SetXY(160, 155);
$pdf->Cell(30, 0, 'side', 0, 0, 'L', false, '', 0, false, 'B', 'B');
$pdf->SetLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->Arrow(155, 155, 180, 155, 2, 5, 15);
// reset x,y position
$pdf->SetXY(15, 30);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// define no-write page regions to avoid text overlapping images
/*
'page' => page number or empy for current page
'xt' => X top
'yt' => Y top
'yb' => Y bottom
'side' => page side ('L' = left or 'R' = right)
*/
$regions = array(array('page' => '', 'xt' => 153, 'yt' => 30, 'xb' => 153, 'yb' => 70, 'side' => 'R'), array('page' => '', 'xt' => 60, 'yt' => 90, 'xb' => 70, 'yb' => 140, 'side' => 'L'), array('page' => '', 'xt' => 143, 'yt' => 130, 'xb' => 153, 'yb' => 180, 'side' => 'R'), array('page' => '', 'xt' => 58, 'yt' => 230, 'xb' => 58, 'yb' => 270, 'side' => 'L'));
// set page regions, check also getPageRegions(), addPageRegion() and removePageRegion()
$pdf->setPageRegions($regions);
// write html text
$pdf->writeHTML($txt, true, false, true, false, '');
$pdf->Output('example.pdf', 'I');
}