PHP – Issue yourself a certificate – PDF and PHP

As you are probably aware, this site is called VitoshAcademy. As far as the site is called this way, I have tought of finding a way to issue automatic certificates with PDF and PHP. And this is exactly what I am going to write about now. In PHP, there is  a library called fpdf.php, which handles pretty well PDFs. And is able to generate a pdf file looking like this:

certificate_pic

It is not very beautiful, but it is PDF, generated with PHP. 🙂 And it even has some links and some maths calculations, which could be useful in some strange situation. 🙂

So, what did I do to achieve this outstanding result? Pretty much, I have said that I require(“fpdf/fpdf.php”); at the beginning of the code, and later I have lost about 30 minutes to set the footer, the header, the cells and the links. I am aware that the colors are somehow strange but I am really not quite fond of beautiful design. So, this is what you get when you run the code:

certificate

The certificate is automatically saved in the same directory as your php file. Feel free to change it as much as you want. Here comes the code:

Here is the code in GitHub.Com.

Enjoy it! ♣

Tagged with: ,