I would like to know if its possible to extract data from a database and then displayed the data in a pdf file ?

google tutorial creating pdf with php.

After having worked on PDF creation in PHP recently myself, I would recommend the TCPDF library over the FPDF library suggested in the tutorial LastMitch posted. Both will do the job fine, but I found the TCPDF library easier to work with, an it has better HTML injection than FPDF, which can sometimes come in handy. They are very similar in how they work, though, and in many cases the method signatures are even identical.

The TCPDF websites lists a lot of useful examples you can learn from.