Create Event Certificates using PHP

By | April 3, 2021

Earlier I have posted an article on create bulk PDF certificates using Python Since running python application is not very practical to newbies i have created this simple script which can be run using php and mysql if required.

Download Complete Source Code Here :

Let us have a basic version of certificate generation using php.

Example 1:

In this we will use one sample JPG file , add one line name and print as PDF.


Create a JPG file as per below dimension

Make sure to leave the dynamic field name empty so we can fill using PHP.

We are going to use the PHP PDF from

Download the latest version of FPDF from this location :

//$name = text to be added, $x= x cordinate, $y = y coordinate, $a = alignment , $f= Font Name, $t = Bold / Italic, $s = Font Size, $r = Red, $g = Green Font color, $b = Blue Font Color
function AddText($pdf, $text, $x, $y, $a, $f, $t, $s, $r, $g, $b) {

//$imgname = image file name , $x= x cordinate, $y = y coordinate
function AddImage($pdf, $imgname, $x, $y) {



//Create A 4 Landscape page
$pdf = new FPDF('L','mm','A4');
$pdf->SetCreator('Haneef Puttur');
// Add background image for PDF
AddImage($pdf,'../template.jpg', 0,0);

//Add a Name to the certificate

AddText($pdf,ucwords('Mahammad Haneef'), 0,80, 'C', 'Helvetica','B',30,3,84,156);


In this tutorial we have created a basic PDF certificate using FPDF. In the next sessions we will explore dynamic options for bulk creation

Download Complete Source Code Here :

As an extended version I have added Multi Page feature.

Here I have created a function which can be called by one line. Each line will create a new PDF page.

Source code :