PHP – Generate PDF on-the-fly with FPDF

Do you want to create PDF documents online for your commercial software? Now you can do it with FPDF class library. FPDF is a PHP class which allows to generate PDF files with pure PHP without depending on external library such as PDFlib.

What’s wrong with PDFlib? well for starters, PDFlib support need to be compiled in the php to make it work, secondly PDFlib isn’t free software meaning that you need to buy a separate license if you with to use PDFlib to generate pdf docs for your commercial apps and business. On the other hand, though not stated in a formal form, FPDF is freely distributable with or without modification and there are no restriction on the use of FPDF class library.

Of course being a pure PHP implementation, FPDF suffers from the lack speed of PDFlib, but the performance degradation won’t be noticeable unless you are planning to generate a large pdf files. FPDF library has been ported to other languages like Ruby, PHP and and C++ as there’s no restriction imposed on it.

Here’s a link to those who are interested to use FPDF in their projects :
http://www.fpdf.org/

17 Replies to “PHP – Generate PDF on-the-fly with FPDF”

  1. Fortunately, I’ve observed lots of discussion telephone calls go along in hearth, along with When i ended up being well prepared pertaining to Murphy’s Regulation to stay whole impact of which day. And also I’m delighted Used to do, since My partner and i necessary every amount of back up to help keep via burning off the actual chat which Chris and also I did that will morning. Here are some Training Found that could save your moolah.

  2. Greetings,

    I was just wondering whether this project is still alive. The latest version is two years old.

    Take care,
    Hynes

  3. I use fpdf in one of my projects. almost two years ago if I’m not mistaken. great library. I like it and I tried to push while I was working in my previous company. so I did some proof of concept test and boom … ! generating from 1000 of data is easy … actually I test more than that since our record at that time is more than 400,000 row in db. that’s what fpdf for … generating repetitive records. but when your client need complex layout and want to edit it ‘on the fly’, you need some other solution :)

    I think that’s what helmi’s trying to said. unfortunately, the solutions is not open source. :(

  4. Pingback: Planet Malaysian
  5. Guys, I believe we all can have a well mannered discussions here. Please don’t flame out on a rude statement with another.

    Please support general open-source community, Respect others, so others respect you. lol… :p

  6. “Easy ah..!? How about repetitive page with a lot of data, let say 1000 of data?”

    Perhaps he should dump his blogger account. Because how about if he has a lot of post in blogger, let’s say 1000 posts and tries to change the template in it’s entirely, pretty damned inefficient. But it’s Easy ah…?

    “How about more complex layout, for example mail merge?”
    How about more complex functionality, for example plugin architecture, or separate template management? Blogger doesn’t have that too.

    “It seem like easy to create on-the-fly pdf”
    It seems easy to create a blog on blogspot/blogger account, and post unintelligent comments. Again, it’s Easy ah…?

    Luckily I’m not as kiasu as that guy. Blogger is a great service and, certain people *cough* *cough* prefer to use blogger over a more robust blogging software. This is real life…

  7. In real life, people use software that is appropriate with tasks at hand. There are times when people use flat database file or text files (xml) as data storage instead of relational database like PostgreSQL. Real-life choices are made varies upon situations. To say that one library is useless because it can’t handle “more complex layout” and “1000 of data” is plainly silly.

  8. Thanks for the tip starky.May I point to you that pdflib-Lite license allow the use of the library without commercial license if you release your software under one of the OSI-approved license?

    But that is not the case with pdflib that’s compiled with PHP though, because it’s stated that

    “PDFlib is available for download at http://www.pdflib.com/products/pdflib/index.html, but requires that you purchase a license for commercial use.”

    There is another library which is commonly use with PHP, cpdf. Though seems interesting, cpdf only allows the use of it’s library for non-commercial purpose without license, thus it is not a “Free Software” and conflicted with OSI definition of “Open Source”.

    I dearly appreciate that people gives constructive views or suggestion regarding the (“real-life”) FOSS pdf library alternatives

  9. I see your point papit.

    NowI know why other open source projects like Mambo and Typo3 did not use PDFlib though the module can be compiled in php. This is because should a company use Mambo as it’s commercial website, the company is subjected to pay PDFlib license due to non-commercial nature of PDFlib.

    Typo3 seems to use FPDF library too. While Mambo uses http://www.ros.co.nz/pdf, a public domain pdf class library for php. They are both widely in use in-real life applications.

    It’s nice to have choices.

  10. –>”Yeah it seem like easy to create on-the-fly pdf, but when come to real life, you need to think this sort of question.

    The goal of this post is to get people thinking about the alternative software library out there, preferably Free Software. Awareness of the Free Software is the main theme of this post, though subtly presented. The FPDF class library is featured on FSF Free Software Directory as opposed to the regularly used PDFlib in php which is not free (as beer or freedom) should you use it in commercial application not matter how small it is.

    –>”Do you have use this in real life application? How about more complex layout, for example mail merge? Easy ah..!? How about repetitive page with a lot of data, let say 1000 of data?

    The FPDF library is widely in use through out the world be it in the commercial/proprietry products and in open source projects due to it flexible nature of simple all-permissive license, I got this from digging through the reference about this free (as in freedom) class library, that is all i know about it. Please pardon me if i’ve given misleading information to you.

    On the other hand, I’m sure a lot of people would appreciate if you can post up suggestions regarding a more robust pdf library, and contribute your wealth of experiences in building-up real-life software for others to share… :)

  11. Do you have use this in real life application? How about more complex layout, for example mail merge? Easy ah..!? How about repetitive page with a lot of data, let say 1000 of data?

    Yeah it seem like easy to create on-the-fly pdf, but when come to real life, you need to think this sort of question.

Comments are closed.