print record from SQL PDO to customized PDF model | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

print record from SQL PDO to customized PDF model

hello i have a database sql PDO and the project is coded with php, the project is for empolyee leave but i want to print the record for each leave in a customized model in pdf i searche a lot for that but i can't found a solution the PDF model i have it in HTML and WORD extension. please help me for resolve that.

25th Dec 2022, 11:39 PM
Mahdi Ettouri
Mahdi Ettouri - avatar
1 Answer
+ 2
There are a few different approaches you can take to generate a PDF from a database record. The simplest approach would be to use a library such as TCPDF or FPDF to generate the PDF from the data stored in the database. You would need to write some code that pulls the data from the database and then creates the PDF using one of these libraries. Alternatively, you could generate the PDF using HTML and CSS. There are several libraries available, such as dompdf, that allow you to take HTML and CSS code and generate a PDF file. Finally, you could generate the PDF using a template engine such as Twig. This would allow you to define a template for the PDF, which would then be populated with data from the database. Whichever approach you choose, the most important thing is to ensure that the data from the database is being used to generate the PDF.
26th Dec 2022, 4:55 AM
Deni Herdian Rusviana
Deni Herdian Rusviana - avatar