Steps to generate pdf in PHP:
1. First download the fpdf library which has lot of examples and a single library file that you will include to create php from there site http://www.fpdf.org/en/download.php, download latest version
like v1.81.
2. Place the file fpdf.php where you want on your server and include it where you want like:
require('fpdf.php');
3. This is complete synatx to generate the pdf in the php.
require('fpdf.php');
$pdf = new PDF();
$pdf->SetFont('Arial','',20);
$pdf->Write(5,"To find out what's new in this tutorial, click ");
$pdf->SetFont('','U');
$pdf->Output("../pdf_files/test.pdf","F"); // this will create the pdf file in the pdf_files folder with name test.pdf
So this is the simplest way to generate the pdf file in php. If you want to create pdf from html or to insert the table in the pdf then you can get examples in the library you downloaded. In case of any further query you can ask to me.
require('fpdf.php');
3. This is complete synatx to generate the pdf in the php.
require('fpdf.php');
$pdf = new PDF();
$pdf->SetFont('Arial','',20);
$pdf->Write(5,"To find out what's new in this tutorial, click ");
$pdf->SetFont('','U');
$pdf->Output("../pdf_files/test.pdf","F"); // this will create the pdf file in the pdf_files folder with name test.pdf
So this is the simplest way to generate the pdf file in php. If you want to create pdf from html or to insert the table in the pdf then you can get examples in the library you downloaded. In case of any further query you can ask to me.
Comments
Post a Comment