Search Cerebrotech Blog

Saturday, 24 June 2017

PHP, MySQL and PDF

After about a year of perfecting the invoicing process of Cerebro Technologies, we decided to automate it. Some people might ask, why not automate it from the onset? The answer is quite technical. When you have a bad process and you automate it, you invariably have a bad automated process and that can spell Disaster!

After getting the MySQL tables (entities) and their relationships, we wanted to export the report/invoice in PDF. There are about four PDF libraries that can work with PHP


  1. FPDF
  2. TCPDF
  3. mPDF
  4. DOMPDF
After reviewing these libraries, we opted for FPDF. Due to the fact that there were lots of tables relating with each other, we had to develop very complex MySQL queries to interact with the database and output the results in a neat format. The FPDF has a lot of useful functions that can help with this task. 

With patience and tenacity, the project was completed in 2 days!