Draws a line between two points.
Line(float x1, float y1, float x2, float y2)
Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
SetLineWidth(float width)
Creating a rectangle. It can be drawn (border only), filled (with no border) or both..
Rect(float x, float y, float w, float h [, string style])
Style of rendering. Possible values are:
<?php require_once "fpdf/fpdf.php"; //fpdf supporting file $pdf = new FPDF('P','mm','A4'); /* A4 - 210 * 297 mm */ $pdf -> AddPage(); //addFont(family,style,file) $pdf -> addFont('Roboto','','Roboto.php'); $pdf -> SetFont('Roboto','',12); $pdf -> Cell(190,10,'Draw lines','B',1,'C'); $pdf -> Cell(190,5,'',0,1,'C',false); /*----------------------Create Line-------------------------------------*/ //line(x1,y1,x2,y2) $pdf -> Line(20,45,150,45); $pdf -> Ln(10); /*----------------------Change Line Width-------------------------------------*/ $pdf -> SetLineWidth(2.0); $pdf -> Line(20,65,150,65); /*----------------------Change Line color-------------------------------------*/ $pdf -> SetDrawColor(117, 117, 255); $pdf -> SetLineWidth(1.5); $pdf -> Line(20,75,20,115); /*----------------------Rectangle-------------------------------------*/ $pdf -> SetDrawColor(255, 0, 0); //Rect(x, y, width, height, 'D'); $pdf -> Rect(25,120,30,30,'D'); $pdf -> Rect(25,160,30,30,'F'); $pdf -> Rect(25,200,30,30,'DF'); //OR $pdf -> Rect(25,240,30,30,'FD'); //without fill $pdf -> Rect(125,200,30,30); $pdf -> Output(); // Display output ?>View Demo
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions