Creating Cell in FPDF Tamil


Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

Syntax


Cell(float w , float h , string txt , mixed border , int ln , string align , boolean fill , mixed link)
Parameters
  • w - Cell width. If 0, the cell extends up to the right margin.
  • h - Cell height. Default value: 0.
  • txt - String to print. Default value: empty string.
  • border - Indicates if borders must be drawn around the cell. The value can be either a number or a string containing some or all of the characters.
    number
    • 0: no border
    • 1: border
    character
    • L: left
    • T: top
    • R: right
    • B: bottom
  • align - Allows to center or align the text. Possible values are:
    • L or empty string: left align (default value)
    • C: center
    • R: right align
  • fill - Indicates if the cell background must be painted (true) or transparent (false). Default value: false.
  • link - URL or identifier returned by AddLink().
$pdf ->Cell(20,5,'Tutor Joes',0,1,'C',false);

MultiCell

This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, This constructor using same parameters as Cell

Syntax


MultiCell(float w , float h , string txt , mixed border, [string align , boolean fill , mixed link])

Write

This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text.It is possible to put a link on the text.

Syntax


Write( float h , string txt , [mixed link])
Parameters
  • h - Line height. Default value: 0.
  • txt - String to print. Default value: empty string.
  • link - URL or identifier returned by AddLink().

Text

Prints a character string. The origin is on the left of the first character, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text.

Syntax


Text(float x, float y, string txt)
Parameters
  • x - Abscissa of the origin.
  • y -Ordinate of the origin.
  • txt - String to print. Default value: empty string.

Source Code

<?php
    require_once "fpdf/fpdf.php"; //fpdf supporting file
 
    $pdf = new FPDF('P','mm','A4');
    $pdf -> AddPage();
 
    //addFont(family,style,file)
    $pdf -> addFont('Roboto','','Roboto.php'); //Adding Custom Font
    $pdf -> SetFont('Roboto','',10);
 
/*-------------------------with line Break-----------------------------------*/
 
	// Cell(width,height,text,border,line Break, [align],[colorFill])
    $pdf -> Cell(30,5,'Tutor Joes',1,1,'C',false);
 
/*-------------------------without line Break--------------------------------*/
    $pdf -> Cell(30,5,'Tutor',1,0,'C',false);
    $pdf -> Cell(30,5,'Joes',1,1,'C',false);
 
/*-----------------------------without Border--------------------------------*/
    $pdf -> Cell(200,5,'Tutor Joes Computer Education',0,1,'C',false);
    $pdf -> Cell(200,5,'',0,1,'C',false);
 
/*--------------Creating Multiple lines in single Cell---------------------*/
 
	// MultiCell(width,height,text,border, [align],[colorFill])
    $pdf -> MultiCell(150,5,'Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quos fugiat minima vero perspiciatis temporibus quia libero impedit accusamus corporis ducimus mollitia, sint sit neque ab officiis facere quidem eaque quasi.',1,'C');
 
/*--------------Text printing using write---------------------*/
	//Write(height,text)
    $pdf -> Cell(200,5,'',0,1,'C',false);
    $pdf -> Write(5,'Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quos fugiat minima vero perspiciatis temporibus quia libero impedit accusamus corporis ducimus mollitia, sint sit neque ab officiis facere quidem eaque quasi.');
    $pdf -> Cell(200,10,'',0,1,'C',false);
    $pdf -> Write(5,'Text with Link - Click Here','https://tutorjoes.in/');
 
/*--------------Text printing using text---------------------*/
	//Write(height,text)
    $pdf -> Cell(200,5,'',0,1,'C',false);
    $pdf -> Text(11,80,'Using Text');
 
    $pdf -> Output(); // Display output
?>
View Demo