How to Create PDF file using fpdf in PHP


I have used a library fpdf open source and very useful library for developers here is a simple tutorial on how to convert How to Convert HTML to PDF with fpdf.

Download fpdf library

With fpdf library we used HTMLparser library contributed by programmers and all other libraries available here you can download and use as per your requirement.



$pdf=new FPDF();

$pdf->SetTitle('FPDF tutorial');



$pdf->Cell(100,10,'FPDF Tutorial',1,0,'C',0);

//Set x and y position for the main text, reduce font size and write content

$pdf->SetXY (10,50);
$pdf->Write(5,'Now your pdf Successfully Create');

//Output the document