Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change them.
SetMargins([float left, float top , [ float right])
Parameters$pdf->SetMargins(3,3);
Defines the left margin. The method can be called before creating the first page.
SetLeftMargin([float margin)
$pdf->SetLeftMargin(7);
Defines the top margin. The method can be called before creating the first page.
SetTopMargin(float margin)
$pdf->SetTopMargin(7);
Defines the right margin. The method can be called before creating the first page.
SetRightMargin(float margin)
$pdf->SetRightMargin(7);
<?php require_once "fpdf/fpdf.php"; //fpdf supporting file $pdf = new FPDF('P','mm','A4'); /*-------------------Create Margin for Entire Document---------------*/ $pdf -> SetMargins(25.4,25.4); $pdf -> AddPage(); //addFont(family,style,file) $pdf -> addFont('Roboto','','Roboto.php'); //Adding Custom Font $pdf -> SetFont('Roboto','',10); $pdf -> Cell(130,5,'Tutor Joes - Oerall Margin',1,1,'C'); /*-------------------Create Right Margin for Entire Document---------------*/ $pdf -> SetRightMargin(15); $pdf -> AddPage(); $pdf -> Cell(50,5,'Tutor Joes - Right Margin',1,1,'R'); /*-------------------Create Left Margin for Entire Document---------------*/ $pdf -> SetLeftMargin(60); $pdf -> AddPage(); $pdf -> Cell(50,5,'Tutor Joes - Left Margin',1,1); /*-------------------Create Top Margin for Entire Document---------------*/ $pdf -> SetTopMargin(60); $pdf -> AddPage(); $pdf -> Cell(50,5,'Tutor Joes - Top Margin',1,1); $pdf -> Output(); // Display output ?>View Demo
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions