Tcpdf vs fpdf?

Which would you prefer for pdf generation using php?

I looked at both and went with FPDF because the API is very straightforward.

I chose FPDF

What i have found so far:
1> fpdf lacks proper code documentation so it’s difficult to track the function arguments.
2> tcpdf is based on fpdf and has many more functionalities like writeHtml() writeHtmlCell() etc
3> joomla too uses tcpdf why not fpdf ?

Please give your suggestions on choosing among two and good tutorials links if any.

thanks

They have a whole web site of documentation and anyone using the library also ought to know PHP and their PHP code is easy to read and modify. There are also lots of extensions that people have written and share to extend the FPDF library of functions. Extending it is really easy to do. If TCPDF is based on FPDF then it is FPDF with a specific set of extensions there whether you need them or not.

Thanks felgall for sharing your idea
One off topic question:
How to get the width of a pdf so that we can customize the width of the columns?
For example
col1 width + col2 width + … coln width = total pdf width

Thanks again.

With FPDF the page size is defined when you create the PDF prior to starting to fill it with content. If you don’t specify the size then the default page size of A4 is used.

You would want to allow left and right margins so that everything is inside the area that prionters can actually print so you’d deduct those off the total width and then divide the remainder by the number of columns you want.

If you didn’t override the default then the base measurements are millimetres. An A4 sheet is 210mm wide so if you allow 10mm left and right margins (which is the default) then you have 190mm to split between your columns.

With FPDF the page size is defined when you create the PDF prior to starting to fill it with content. If you don’t specify the size then the default page size of A4 is used.

You would want to allow left and right margins so that everything is inside the area that prionters can actually print so you’d deduct those off the total width and then divide the remainder by the number of columns you want.

If you didn’t override the default then the base measurements are millimetres. An A4 sheet is 210mm wide so if you allow 10mm left and right margins (which is the default) then you have 190mm to split between your columns.

Note that I don’t have all those default sizes memorised, I just looked them up quickly in the FPDF documentation while I was writing this reply.

Thanks felgall for your valueable idea.

i think tcpdf has support for unicode as well where as fpdf doesnt use to have(may be now it does have)