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

eZ debug

Timing: Jan 17 2025 23:48:01
Script start
Timing: Jan 17 2025 23:48:01
Module start 'content'
Timing: Jan 17 2025 23:48:01
Module end 'content'
Timing: Jan 17 2025 23:48:01
Script end

Main resources:

Total runtime0.1837 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0087 588.8203180.8438
Module start 'content' 0.00870.0051 769.664194.5703
Module end 'content' 0.01380.1699 864.2344525.2500
Script end 0.1837  1,389.4844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00371.9987200.0002
Check MTime0.00150.7910200.0001
Mysql Total
Database connection0.00110.587310.0011
Mysqli_queries0.135873.89531410.0010
Looping result0.00181.00311390.0000
Template Total0.169592.310.1695
Template load0.00090.464310.0009
Template processing0.168791.798410.1687
Override
Cache load0.00060.324910.0006
Sytem overhead
Fetch class attribute can translate value0.00080.431110.0008
XML
Image XML parsing0.00020.130210.0002
General
dbfile0.00180.9745200.0001
String conversion0.00000.003830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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