A simple PDF e-certificates generator made with PHP where people can generate and download their e-certificates.
The installation is super easy. You just need to checkout all files to your webserver directory.
Replace dummy 'certificate.pdf' with the PDF file of your certificate design. Make sure that the design does not have name of the participant, which will be written while generating the e-certificate.
Configure the dimension of PDF file in points; width and height in 'template.php' file.
$pdf->addPage('L', [792, 612]);
Configure the font family and the font size.
$pdf->AddFont('Roboto-Regular');
$pdf->SetFont('Roboto-Regular', '', 48);
The following fonts are already included in the package: Courier, Droid Serif, Helvetica, Roboto Bold, Roboto Regular, Symbol, Times Roman, Zapfdingbats. More fonts can be added as per this tutorial.
Configure the font color in RGB.
$pdf->SetTextColor(97, 101, 107);
Move the pointer to the correct position where we need to write the name. // Move to 500 points from the top
$pdf->ln(500);
Change the text alignment (6th parameter) as per your requirement. Check the mannual for more info.
$pdf->Cell(0, 0, $name, 0, 1, 'C');
To make sure that only people who have attended the event can receive the e-certificate, we will have an array of names (in lowercase letters) which will be used verify the name of the participant while generating the e-certificate.
In 'data.php' add all the names in lowercase letters to the constant array NAMES
.
The home page can be customized as per your need by changing HTML (index.php) and CSS (custom.css).
I have used the awesome FPDF with FPDI for this application.