<?php
//============================================================+
// File name   : example_012.php
// Begin       : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 012 for TCPDF class
//               Graphic Functions
//
// Author: Nicola Asuni
//
// (c) Copyright:
//               Nicola Asuni
//               Tecnick.com LTD
//               www.tecnick.com
//               info@tecnick.com
//============================================================+

/**
 * Creates an example PDF TEST document using TCPDF
 * @package com.tecnick.tcpdf
 * @abstract TCPDF - Example: Graphic Functions
 * @author Nicola Asuni
 * @since 2008-03-04
 */

// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATIONPDF_UNITPDF_PAGE_FORMATtrue'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_LEFTPDF_MARGIN_TOPPDF_MARGIN_RIGHT);

// set auto page breaks
$pdf->SetAutoPageBreak(TRUEPDF_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'''10);

// add a page
$pdf->AddPage();

$style = array('width' => 0.5'cap' => 'butt''join' => 'miter''dash' => '10,20,5,10''phase' => 10'color' => array(25500));
$style2 = array('width' => 0.5'cap' => 'butt''join' => 'miter''dash' => 0'color' => array(25500));
$style3 = array('width' => 1'cap' => 'round''join' => 'round''dash' => '2,10''color' => array(25500));
$style4 = array('L' => 0,
                
'T' => array('width' => 0.25'cap' => 'butt''join' => 'miter''dash' => '20,10''phase' => 10'color' => array(100100255)),
                
'R' => array('width' => 0.50'cap' => 'round''join' => 'miter''dash' => 0'color' => array(5050127)),
                
'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(064128));
$style6 = array('width' => 0.5'cap' => 'butt''join' => 'miter''dash' => '10,10''color' => array(01280));
$style7 = array('width' => 0.5'cap' => 'butt''join' => 'miter''dash' => 0'color' => array(2551280));

// Line
$pdf->Text(54'Line examples');
$pdf->Line(5108030$style);
$pdf->Line(510530$style2);
$pdf->Line(5108010$style3);

// Rect
$pdf->Text(1004'Rectangle examples');
$pdf->Rect(100104020'DF'$style4, array(220220200));
$pdf->Rect(145104020'D', array('all' => $style3));

// Curve
$pdf->Text(534'Curve examples');
$pdf->Curve(540305570456075null$style6);
$pdf->Curve(804070751504510075'F'$style6);
$pdf->Curve(14040150551804520075'DF'$style6, array(200220200));

// Circle and ellipse
$pdf->Text(579'Circle and ellipse examples');
$pdf->SetLineStyle($style5);
$pdf->Circle(25,105,20);
$pdf->Circle(25,105,1090180null$style6);
$pdf->Circle(25,105,10270360'F');
$pdf->Circle(25,105,10270360'C'$style6);

$pdf->SetLineStyle($style5);
$pdf->Ellipse(100,103,40,20);
$pdf->Ellipse(100,105,20,10090180null$style6);
$pdf->Ellipse(100,105,20,100270360'DF'$style6);

$pdf->SetLineStyle($style5);
$pdf->Ellipse(175,103,30,15,45);
$pdf->Ellipse(175,105,15,7.504590180null$style6);
$pdf->Ellipse(175,105,15,7.5045270360'F'$style6, array(220200200));

// Polygon
$pdf->Text(5129'Polygon examples');
$pdf->SetLineStyle(array('width' => 0.5'cap' => 'butt''join' => 'miter''dash' => 0'color' => array(000)));
$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$style70$style6), array(220200200));
$pdf->Polygon(array(120,135,140,135,150,155,110,155), 'D', array($style60$style7$style6));
$pdf->Polygon(array(160,135,190,155,170,155,200,160,160,165), 'DF', array('all' => $style6), array(220220220));

// Polygonal Line
$pdf->SetLineStyle(array('width' => 0.5'cap' => 'butt''join' => 'miter''dash' => 0'color' => array(00164)));
$pdf->PolyLine(array(80,165,90,160,100,165,110,160,120,165,130,160,140,165), 'D', array(), array());

// Regular polygon
$pdf->Text(5169'Regular polygon examples');
$pdf->SetLineStyle($style5);
$pdf->RegularPolygon(2019015601'F');
$pdf->RegularPolygon(55190156);
$pdf->RegularPolygon(55190106450'DF', array($style60$style70$style7$style7));
$pdf->RegularPolygon(9019015301'DF', array('all' => $style5), array(200220200), 'F', array(255200200));
$pdf->RegularPolygon(125190154301null, array('all' => $style5), nullnull$style6);
$pdf->RegularPolygon(1601901510);

// Star polygon
$pdf->Text(5209'Star polygon examples');
$pdf->SetLineStyle($style5);
$pdf->StarPolygon(202301520301'F');
$pdf->StarPolygon(5523015125);
$pdf->StarPolygon(552307125450'DF', array('all' => $style7), array(220220200), 'F', array(255200200));
$pdf->StarPolygon(902301520601'DF', array('all' => $style5), array(220220200), 'F', array(255200200));
$pdf->StarPolygon(1252301552301null, array('all' => $style5), nullnull$style6);
$pdf->StarPolygon(16023015103);
$pdf->StarPolygon(16023075026);

// Rounded rectangle
$pdf->Text(5249'Rounded rectangle examples');
$pdf->SetLineStyle(array('width' => 0.5'cap' => 'butt''join' => 'miter''dash' => 0'color' => array(000)));
$pdf->RoundedRect(525540303.50'1111''DF');
$pdf->RoundedRect(5025540306.50'1000');
$pdf->RoundedRect(95255403010.0'1111'null$style6);
$pdf->RoundedRect(14025540308.0'0101''DF'$style6, array(200200200));

// Arrows
$pdf->Text(185249'Arrows');
$pdf->SetLineStyle($style5);
$pdf->SetFillColor(25500);
$pdf->Arrow(2002801852660515);
$pdf->Arrow(2002801902631515);
$pdf->Arrow(2002801952612515);
$pdf->Arrow(2002802002603515);

// - . - . - . - . - . - . - . - . - . - . - . - . - . - . -

// ellipse

// add a page
$pdf->AddPage();

$pdf->Cell(00'Arc of Ellipse');

// center of ellipse
$xc=100;
$yc=100;

// X Y axis
$pdf->SetDrawColor(200200200);
$pdf->Line($xc-50$yc$xc+50$yc);
$pdf->Line($xc$yc-50$xc$yc+50);

// ellipse axis
$pdf->SetDrawColor(200220255);
$pdf->Line($xc-50$yc-50$xc+50$yc+50);
$pdf->Line($xc-50$yc+50$xc+50$yc-50);

// ellipse
$pdf->SetDrawColor(200255200);
$pdf->Ellipse($xc$yc3015450360'D', array(), array(), 2);

// ellipse arc
$pdf->SetDrawColor(25500);
$pdf->Ellipse($xc$yc3015454590'D', array(), array(), 2);


// ---------------------------------------------------------

//Close and output PDF document
$pdf->Output('example_012.pdf''I');

//============================================================+
// END OF FILE
//============================================================+