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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 29 2025 23:47:01
Script start
Timing: Jan 29 2025 23:47:01
Module start 'layout'
Timing: Jan 29 2025 23:47:01
Module start 'content'
Timing: Jan 29 2025 23:47:02
Module end 'content'
Timing: Jan 29 2025 23:47:02
Script end

Main resources:

Total runtime0.0376 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 588.1250151.2109
Module start 'layout' 0.00860.0044 739.335936.6484
Module start 'content' 0.01300.0224 775.984490.8438
Module end 'content' 0.03540.0022 866.828133.9922
Script end 0.0375  900.8203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00307.9720140.0002
Check MTime0.00143.7599140.0001
Mysql Total
Database connection0.00112.822510.0011
Mysqli_queries0.006016.020830.0020
Looping result0.00000.045010.0000
Template Total0.00164.310.0016
Template load0.00133.553810.0013
Template processing0.00030.723710.0003
Override
Cache load0.00102.686710.0010
General
dbfile0.006417.126380.0008
String conversion0.00000.026040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs