当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF::Polygon方法代码示例

本文整理汇总了PHP中TCPDF::Polygon方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::Polygon方法的具体用法?PHP TCPDF::Polygon怎么用?PHP TCPDF::Polygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDF的用法示例。


在下文中一共展示了TCPDF::Polygon方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
//.........这里部分代码省略.........
开发者ID:fooman,项目名称:tcpdf,代码行数:101,代码来源:Example012Test.php

示例2: prepareRowAsPdf

 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial    GIS POLYGON object
  * @param string $label      Label for the GIS POLYGON object
  * @param string $fill_color Color for the GIS POLYGON object
  * @param array  $scale_data Array containing data related to scaling
  * @param TCPDF  $pdf        TCPDF instance
  *
  * @return TCPDF the modified TCPDF instance
  * @access public
  */
 public function prepareRowAsPdf($spatial, $label, $fill_color, $scale_data, $pdf)
 {
     // allocate colors
     $red = hexdec(mb_substr($fill_color, 1, 2));
     $green = hexdec(mb_substr($fill_color, 3, 2));
     $blue = hexdec(mb_substr($fill_color, 4, 2));
     $color = array($red, $green, $blue);
     // Trim to remove leading 'POLYGON((' and trailing '))'
     $polygon = mb_substr($spatial, 9, mb_strlen($spatial) - 11);
     // If the polygon doesn't have an inner polygon
     if (mb_strpos($polygon, "),(") === false) {
         $points_arr = $this->extractPoints($polygon, $scale_data, true);
     } else {
         // Separate outer and inner polygons
         $parts = explode("),(", $polygon);
         $outer = $parts[0];
         $inner = array_slice($parts, 1);
         $points_arr = $this->extractPoints($outer, $scale_data, true);
         foreach ($inner as $inner_poly) {
             $points_arr = array_merge($points_arr, $this->extractPoints($inner_poly, $scale_data, true));
         }
     }
     // draw polygon
     $pdf->Polygon($points_arr, 'F*', array(), $color, true);
     // print label if applicable
     if (isset($label) && trim($label) != '') {
         $pdf->SetXY($points_arr[2], $points_arr[3]);
         $pdf->SetFontSize(5);
         $pdf->Cell(0, 0, trim($label));
     }
     return $pdf;
 }
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:44,代码来源:GIS_Polygon.class.php

示例3: polygon

 /**
  * Draws a polygon
  *
  * The polygon is formed by joining all the points stored in the $points
  * array.  $points has the following structure:
  * <code>
  * array(0 => x1,
  *       1 => y1,
  *       2 => x2,
  *       3 => y2,
  *       ...
  *       );
  * </code>
  *
  * See {@link Style::munge_color()} for the format of the color array.
  * See {@link Cpdf::setLineStyle()} for a description of the $style
  * parameter (aka dash)
  *
  * @param array $points
  * @param array $color
  * @param float $width
  * @param array $style
  * @param bool  $fill  Fills the polygon if true
  */
 function polygon($points, $color, $width = null, $style = null, $fill = false, $blend = "Normal", $opacity = 1.0)
 {
     dompdf_debug("trace", "({$points}, [{$color['0']}, {$color['1']}, {$color['2']}], {$width}, {$style}, {$fill}, {$blend}, {$opacity})");
     //$this->_set_fill_color($color);
     //$this->_set_stroke_color($color);
     $this->_set_line_transparency($blend, $opacity);
     if ($fill) {
         $this->_set_fill_transparency($blend, $opacity);
     }
     //if (!$fill && isset ($width)) {
     //	$this->_set_line_style($width, "square", "miter", $style);
     //}
     $this->_pdf->Polygon($points, $fill ? 'F' : '', $this->_make_line_style($color, $width, "square", "miter", $style), $this->_get_rgb($color));
 }
开发者ID:Razinsky,项目名称:echaude-com,代码行数:38,代码来源:tcpdf_adapter.cls.php

示例4: array

$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)));
$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));
// Regular polygon
$pdf->Text(5, 172, '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, 212, 'Star polygon examples');
$pdf->SetLineStyle($style5);
开发者ID:hermansyam,项目名称:cardiac,代码行数:31,代码来源:example_012.php

示例5: array

$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)));
$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));
// Regular polygon
$pdf->Text(5, 172, "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, $style6));
$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, 212, "Star polygon examples");
$pdf->SetLineStyle($style5);
开发者ID:arhe,项目名称:pwak,代码行数:31,代码来源:example_012.php

示例6: array

    $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);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('box_generator.pdf', 'I');
开发者ID:roberteliason,项目名称:laserbox,代码行数:31,代码来源:pdf_test.php

示例7: array

$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 aproximate 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="../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('../images/image_demo.jpg', 155, 30, 40, 40, 'JPG', '', '', true);
$pdf->Image('../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, 'xt,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);
开发者ID:caseyi,项目名称:BLIS,代码行数:31,代码来源:example_064.php

示例8: prepareRowAsPdf

 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial    GIS MULTIPOLYGON object
  * @param string $label      Label for the GIS MULTIPOLYGON object
  * @param string $fill_color Color for the GIS MULTIPOLYGON object
  * @param array  $scale_data Array containing data related to scaling
  * @param TCPDF  $pdf        TCPDF instance
  *
  * @return TCPDF the modified TCPDF instance
  * @access public
  */
 public function prepareRowAsPdf($spatial, $label, $fill_color, $scale_data, $pdf)
 {
     /** @var PMA_String $pmaStr */
     $pmaStr = $GLOBALS['PMA_String'];
     // allocate colors
     $red = hexdec($pmaStr->substr($fill_color, 1, 2));
     $green = hexdec($pmaStr->substr($fill_color, 3, 2));
     $blue = hexdec($pmaStr->substr($fill_color, 4, 2));
     $color = array($red, $green, $blue);
     // Trim to remove leading 'MULTIPOLYGON(((' and trailing ')))'
     $multipolygon = $pmaStr->substr($spatial, 15, $pmaStr->strlen($spatial) - 18);
     // Separate each polygon
     $polygons = explode(")),((", $multipolygon);
     $first_poly = true;
     foreach ($polygons as $polygon) {
         // If the polygon doesn't have an inner polygon
         if ($pmaStr->strpos($polygon, "),(") === false) {
             $points_arr = $this->extractPoints($polygon, $scale_data, true);
         } else {
             // Separate outer and inner polygons
             $parts = explode("),(", $polygon);
             $outer = $parts[0];
             $inner = array_slice($parts, 1);
             $points_arr = $this->extractPoints($outer, $scale_data, true);
             foreach ($inner as $inner_poly) {
                 $points_arr = array_merge($points_arr, $this->extractPoints($inner_poly, $scale_data, true));
             }
         }
         // draw polygon
         $pdf->Polygon($points_arr, 'F*', array(), $color, true);
         // mark label point if applicable
         if (isset($label) && trim($label) != '' && $first_poly) {
             $label_point = array($points_arr[2], $points_arr[3]);
         }
         $first_poly = false;
     }
     // print label if applicable
     if (isset($label_point)) {
         $pdf->SetXY($label_point[0], $label_point[1]);
         $pdf->SetFontSize(5);
         $pdf->Cell(0, 0, trim($label));
     }
     return $pdf;
 }
开发者ID:FilipeRamosFernandes,项目名称:phpmyadmin,代码行数:56,代码来源:GIS_Multipolygon.class.php

示例9: 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');
}
开发者ID:zncode,项目名称:codebase,代码行数:92,代码来源:index.php


注:本文中的TCPDF::Polygon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。