I am posting the code of creating PDF files using PHP. You can use the PDF Lib that comes with the PHP, but then you have to pay them to create PDF files without their ads on them. Here is the code and links that would allow you to create your own PDF files without any ads on them and without paying a single cent to them.
The PDF lib is available at http://www.fpdf.org/. You can download the ZIP or TGZ files from this site and open them in any directory.
All you need to do is Define the font in your code and include the fpdf.php file into your code.
Below is a short code that helps you create a sample PDF file. Creating PDF file helps a lot in generating reports for the database transactions or creating downloadable question papers for online quizzes etc, etc.
This code works perfectly when I tested it.
Code follows:
HTML file to create PDF file.
$pdf=new PDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetDrawColor(200);
$pdf->DashedRect(20,10,190,40);
$pdf->SetFont('Arial','B',20);
$pdf->SetXY(40,10);
$pdf->Cell(125,30,'Congrats! You created your first PDF file.',0,0,'C',0);
$pdf->Output();
?>
You can find the tutorials and API references at http://www.fpdf.org/. If I remember my example
code is took from the tutorials posted at http://www.fpdf.org/.
Hope this helps some one. Please let me know if there is some problem with the code. I'll be glad
to help you.