“Redesign your blog/website” contest

The guys over at Buy Templates are nice enough to sponsor prizes for this contest. I know a few of you have just started a blog or a website, so I’m sure it’ll be great if you can win some good quality templates, logo, and banners for your new blog/site. Everyone who participates will also [...]



fpdf FPDF   Create PDF files with PHPFirst of all, this post is tailored to PHP developers out there or at least to anyone who’s interested to create an engine or a web application that can create PDF files.

If you are working in an I.T company that produces billing statements or even web reports, then you’d probably be asked to create PDF documents. That’s where you need a PDF creation engine, such as FPDF. It’s free (for both personal and commercial use)


Now, honestly, I haven’t tried FPDF yet. I knew this from a good friend of mine this morning. He needs to create billing statements for the company’s clients.

FPDF features:

  • Choice of measure unit, page format and margins
  • Page header and footer management
  • Automatic page break
  • Automatic line break and text justification
  • Image support (JPEG and PNG)
  • Colors
  • Links
  • TrueType, Type1 and encoding support
  • Page compression

FPDF works for both PHP4 and PHP5 and doesn’t require you to install anything else (according to the author).

If you have used FPDF, please feel free to share your experience with us here on the comments section. To know more and download FPDF, go to their site here.

There is also a JAVA alternative, called iText. I’ve heard of iText a couple of years ago and it was still under heavy development at that time. I’m not sure how it is now, but if you want to give it a try, iText project site is located here.

Bookmark and Share



Subscribe Now

If you enjoyed this post, feel free to subscribe to be notified of new posts at Craving Tech!

{ 10 comments… read them below or add one }

Josh 31 January, 2008 at 8:39 pm

FPDF is one of the better PDF-generating PHP libraries out there. I know, because I’ve gone through a few :)

Reply to this comment

joyap 3 May, 2009 at 10:41 pm

can it convert dynamically generated data to php? Ive been trying to convert a php page to pdf but it only converts the html part. Not the generated data from db. I need help on this. Thanks.

nelrocamora 24 September, 2008 at 8:02 pm

i am working with php and the company required me to produce reports. i have read an article about fpdf, please help. is it really working?

Reply to this comment

Michael Aulia 24 September, 2008 at 11:09 pm

Sorry I’m not sure, as I myself haven’t used FPDF before. I hope you can find better information out there!

Reply to this comment

Josh 24 September, 2008 at 11:14 pm

Yep, it definitely works — I’ve used it for a number of web apps. It’s one of the more mature PDF libraries for PHP. Otherwise you could try the Zend Framework PDF module.

Reply to this comment

Chris 30 September, 2009 at 7:56 pm

I’m having some problems with the FPDF class. I’m hoping you can help me. I’m using FPDF to write some text on a PDF. I’m displaying 8 different cells of text. The Cells are being displayed, but after two cells, it puts the next cell onto a new page as If I had asked for a new PDF page to be made, but I did not. I’m guessing it is somehow pushing them down and pushing it onto the next page. How can I get rid of these annoying spaces and make it all fit on only the one PDF page?

I posted my complete issue with the code here: http://stackoverflow.com/questions/1496888/why-are-there-unexpected-spaces-on-my-pdf-using-fpdf-with-php

You can view the outputted pdf here: http://idea-palette.com/pdf/

Reply to this comment

Michael Aulia 30 September, 2009 at 11:32 pm

Hm sorry I can’t help you Chris as I haven’t actually tried the FPDF class myself. We are using a Perl engine called PDFEverywhere in the office, so I haven’t had a chance to try this out :(

Joshua D. Burns 22 January, 2010 at 8:34 am

I’ve actually been delving heavily into FPDF over the past few days and it’s been an absolute blessing to my experience. Its object oriented programming interface, list of features and simple logic structure makes generating PDFs a snap- What other library allows you to create a PDF complete with text in only three lines of code?

If you’re familiar with PHP and OOP, I guarantee you’ll love FPDF. It always has a great following (which is always great when you run into little issues), and best of all it’s absolutely 100% free to use commercially in your own applications if need be.

5 stars in my book!

Reply to this comment

Michael Aulia 23 January, 2010 at 7:15 pm

Thanks Joshua! I’ll certainly keep this in mind if we ever going to create an engine to create PDF files using PHP

Michael Aulia 4 May, 2009 at 12:27 am

Sorry I don’t use FPDF so unfortunately I can’t help you out on this one…

Reply to this comment

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled

Previous post:

Next post:



ss_blog_claim=90a03beb48f2cae080e36591e278f2e0