Question

I have used zend framework and now want to use zf2. I used zend_pdf for zf1. I know some difference between tc_pdf and zend_pdf version 1 but no idea about zend_pdf verison 2. If anyone have idea about zend_pdf verion 2 then give me a brief about zf2 zend_pdf comparing to tc_pdf. Also if any pdf is better than tc_pdf and zend_pdf please give me some suggation.

Was it helpful?

Solution

Zend_Pdf from ZF2 is functionally the same as Zend_Pdf from ZF1. Also, Zend_Pdf isn't actually a part of ZF2 core any more.

TCPDF is a slightly higher level API so it is a bit easier to get started with. Plus, you don't have to worry about autoloading - just require() it in your source. TCPDF handles international characters well, including right-to-left rendering of text, which Zend_Pdf does not.

Zend_Pdf on the other hand, supports reading existing documents into memory and manipulating them (eg. adding pages to them, pulling pages out, manipulating existing pages, using fonts that are already embedded, etc), which TCPDF does not.

This is by no means a thorough comparison, but if any of the points mentioned above are critical requirements, then that will probably dictate which one you'll use. If none of the points above are critical requirements, then I would recommend you spend a bit more time looking at the API of each library and choosing the one that is the best fit for your requirements, coding style, etc. They are both great libraries.

[UPDATE - June 2013] I was just doing some work with transparent images and discovered that TCPDF is much more performant than Zend_Pdf in this area. I wrote a script that created a page, added an image and then added a second, transparent image on top of that image. I looped through to create 100 pages. Zend_Pdf from ZF1 took 14 seconds. ZendPdf from github (ie. the version that got split off from ZF2) took 13 seconds. TCPDF took 3 seconds. This may be significant for some people, hence I thought it worthwhile updating this answer. (By way of comparison, when I substituted a non-transparent image for the second image, both versions of Zend_Pdf completed the task in under a second, so the transparency was definitely the cause of the slow down).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top