Create PDF with php using FPDF

Create PDF with php using FPDF

If you are looking for a PDF library to handle PDF files with PHP, I will recommend to use FPDF library. FPDF is a php class file which makes the pdf generation easier than before. It has all the built in functions for creating pdf. It helps in creating documents at run time with PHP.

Download this call file from the offical website http://www.fpdf.org/

FPDF has many advantages which are not available in other PDF libraries. This class also supports many other languages other than english which makes it different from other libraries.

See the sample code below

 

In this code I have included the class file downloaded from the website. Then create a new object of FPDF. default pages for the pdf are in A4 portrait and all the units are in milimeter.

This PHP code will generate a PDF file that will have a single line “Helloo World!”

$pdf->SetFont(‘Arial’,’B’,16); // this line sets the font, style, size to the text. here B stands for bold.

Use $pdf->Output(); at the end of the file to generate PDF file.

You can find more tutorials about FPDF on the official website.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest updates, web design resources and tools.

You have Successfully Subscribed!

About The Author

    ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!

Pin It on Pinterest

Share This

Share This

Share this post with your friends!