How to Generate PDF from MySQL Data using PHP

1484 0
$1*/ mo hosting! Get going with GoDaddy!

In this tutorial I explains how to generate PDF from MySQL Data using PHP. You are going to see how to convert MySQL Data into PDF using FPDF library.

What id FPDF ?

FPDF is a PHP class which allows to generate PDF files with  PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

FPDF has other advantages: high level functions. Here is a list of its main features:

  • Choice of measure unit, page format and margins
  • Page header and footer management
  • Automatic page break
  • Automatic line break and text justification
  • Image support (JPEG, PNG and GIF)
  • Colors
  • Links
  • TrueType, Type1 and encoding support
  • Page compression

The following snippet show a basic PDF generated with FPDF :

First a db with empadata. Under db empdata create table tblemployee-

Structure of tblemployee


genratepdf.php page

 

Comments

comments

In this article

Join the Conversation