Forums / Developer / ezcDocument vs Zend_Pdf

ezcDocument vs Zend_Pdf

Author Message

Sylvain Gogel

Saturday 14 November 2009 12:27:44 pm

Zend 1 - 0 eZComponent

Today i build a module that contains a view that generate a pdf file.

On previous installations we use a custom pdf lib (non standard, got some issues, not OO etc..), as ez4.1 comes bundle with ezc, i gived it a try. but unfortunatly got an issue with Haru driver.

the doc shows the following:

The Haru driver is pretty fast, but currently has issues with some special characters. It is the default driver, but can be explicitly used by setting the driver option on the PDF class, like:

$pdf = new <a href="http://www.ezcomponents.org/docs/api/trunk/Document/ezcDocumentPdf.html">ezcDocumentPdf</a>();
$pdf->options->driver = new <a href="http://www.ezcomponents.org/docs/api/trunk/Document/ezcDocumentPdfHaruDriver.html">ezcDocumentPdfHaruDriver</a>();

pretty nice. Unfortunatly the constructor instanciate a HaruDriver, so you cannot switch to another driver if you don't have haru working on your env ;(

So i switch to Zend_Pdf component. Works like a charms

Step to install:

  1. Download ZendFramework
  2. Create folder $EZ_HOME/lib/zf
  3. Unzip your tarball
  4. copy Zend/Pdf/* and Zend/Pdf.php to $EZ_HOME/lib/zf
  5. add a line to $EZ_HOME/autoload.php to add ./lib/zf to the php include path
  6. generate autoloads php bin/php/ezpgenerateautoload.php

Works like a charm (without any fancy Haru lib)

The Haru driver is pretty fast, but currently has issues with some special characters. It is the default driver, but can be explicitly used by setting the driver option on the PDF class, like:

$pdf = new <a href="http://www.ezcomponents.org/docs/api/trunk/Document/ezcDocumentPdf.html" mce_href="http://www.ezcomponents.org/docs/api/trunk/Document/ezcDocumentPdf.html">ezcDocumentPdf</a>();
$pdf->options->driver = new <a href="http://www.ezcomponents.org/docs/api/trunk/Document/ezcDocumentPdfHaruDriver.html" mce_href="http://www.ezcomponents.org/docs/api/trunk/Document/ezcDocumentPdfHaruDriver.html">ezcDocumentPdfHaruDriver</a>();

--
http://www.ecedi.fr
Agence Web, Créa/Conseils, Accessibilité
eZPublish, Drupal, Zend, Symfony

Gaetano Giunta

Saturday 14 November 2009 2:49:31 pm

Unfortunatly the constructor instanciate a HaruDriver, so you cannot switch to another driver if you don't have haru working on your env ;(

1 - did you file this as a bug?

2 - did you try a quick hack to the constructor to see if using the tcpdf driver was ok?

3 - according to http://ezcomponents.org/docs/api/2009.1.2/Document/ezcDocument.html#method__construct, you can pass an options object to the constructor. Maybe this is the way to avoid having the haru stuff loaded?

Principal Consultant International Business
Member of the Community Project Board