This posting will discuss about how to generate PDF files with pure PHP. It means generating pdf without using the PDFlib library. To do that we can use FPDF. F here stands for Free, we may use it for any kind of usage and modify it to suit our needs.
One of the advantage of FPDF is we don't need to enable any extension. Just include it in our code. It also works with PHP 4 and PHP 5. Below are the steps to use FPDF :
- Download the latest FPDF here
- Let's start with writing down Hello World. Here is the code
require_once ('fpdf.php'); $pdfObj = new FPDF(); $pdfObj->AddPage(); $pdfObj->SetFont('Tahoma','B',16); $pdfObj->Cell(90,10,'Hello World!'); $pdfObj->Output();
- That's it. We have coded the introduction thing
- To get more tutorial, go to your fpdf directory > tutorial or go to online tutorial
- To get documentation of FPDF API, go to your fpdf directory > doc or go to online documentation
No comments:
Post a Comment