pdf exports : how to align content in cells ?

Author Message

francis Nart

Friday 21 July 2006 8:48:42 am

Hi,

we have a problem when exporting content in pdf. When we have a table in a template, we can't center or align on the right the content of the table cells in the pdf export. Has any of you found a solution ?

Thanks for your help !

Francis.

Kåre Køhler Høvik

Tuesday 25 July 2006 1:54:50 am

Hi

I think you can use the <i>justification</i> td element attribute din the PDF templates to align the cell content.

<tr><td justification="center">Some text</td></tr>

Kåre Høvik

francis Nart

Tuesday 25 July 2006 3:26:49 am

Unfortunately Kåre, alignment doesn't work using the following codes :

<tr>
<td align="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ),hash('align', 'center' ) )}</td>
</tr>
{pdf(table, $tableau, hash('showLines',2,
'firstRowTitle',1,
'titleCellCMYK',array( 0, 0, 0 ),
'titleTextCMYK',array(0.9,0.3,0,0.2),
'titleFontSize',8,
'cellCMYK',array( 0, 0, 0 ),
'textCMYK',array( 255, 255, 255 ),
'rowGap',4,
'colGap',4,
'cellPadding',0,
'width',435,
'repeatTableHeader',0) )}

We also tried the "cellData" option which is used in "lib/ezpdf/classes/class.ezpdftable.php" but the aligment doesn't change either:

{pdf(table, $tableau, hash('cellData',array('0,0',array('justification',right)),
'showLines',2,
'firstRowTitle',1,
'titleCellCMYK',array( 0, 0, 0 ),
'titleTextCMYK',array(0.9,0.3,0,0.2),
'titleFontSize',8,
'cellCMYK',array( 0, 0, 0 ),
'textCMYK',array( 255, 255, 255 ),
'rowGap',4,
'colGap',4,
'cellPadding',0,
'width',435,
'repeatTableHeader',0) )}

we're stuck with this !

Kåre Køhler Høvik

Tuesday 25 July 2006 4:01:00 am

Hi

What about this:

{pdf(table, $tableau, hash('cellData',array('0,0',array('justification',right,
 'showLines',2,
 'firstRowTitle',1,
 'titleCellCMYK',array( 0, 0, 0 ),
 'titleTextCMYK',array(0.9,0.3,0,0.2),
 'titleFontSize',8,
 'cellCMYK',array( 0, 0, 0 ),
 'textCMYK',array( 255, 255, 255 ),
 'rowGap',4,
 'colGap',4,
 'cellPadding',0,
 'width',435,
 'repeatTableHeader',0) ) )}

Kåre Høvik

Vanessa Merle

Tuesday 25 July 2006 5:48:35 am

Hello Kåre,

The content of the table cells are still not aligned on the right with this code.
For me, the best solution would be to put the attribute "justification" or "align" in the template for certain cells but that does not function.

These various codes does not align the text :

<tr>
<td align="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ),hash('align', 'center' ) )}</td>
</tr>

Do you have an idea?

Thanks.

Vanessa

fabian schoen

Wednesday 18 October 2006 6:04:50 am

@Vanessa

Did you figure out, how to align it?

regards
fabian

Vittal Aithal

Friday 22 December 2006 4:55:00 am

Hi Kåre,

Passing in cellData (or cols for that matter) isn't going to work, because the array gets serialised into a string with value "Array" before it gets passed to any of the underlying PDF generation code. Having delved around inside the code for a bit (and got royally confused :), I've added a patch to http://issues.ez.no/IssueView.php?Id=8724 to allow alignment to be set within the set-block variable.

However, you need to use a syntax like:

<tr>
<td:align:left:>{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td:align:center:>{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td:align:right:>{pdf( 'text', $text|wash( 'pdf' ) )}</td>
</tr>

There does seem to be some cruftiness in the PDF code - are there any plans to review the PDF stuff and bring it back to speed?

Regards
Vittal

Vittal Aithal | Geek | VisionWT

Award-winning brand and technical development

www.visionwt.com

James Ward

Wednesday 16 April 2008 1:53:58 pm

I know this thread is old but hopefully someone is still watching. I'm trying to export a pdf table and having no luck setting cell widths in ez 3.10.

I added Vittal's patch and got alignment working.

I see in the file class.ezpdftable.php parameters that should allow the setting of cell width but I can not get it to work.

I have tried the following:

<td:width:200:>some test text</td>

and it seems to have no effect on the cell width.

Any suggestions would be much appreciated.

working at www.wardnet.com
blogging at www.jamesward.ca

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 18 2025 11:35:08
Script start
Timing: Jan 18 2025 11:35:08
Module start 'layout'
Timing: Jan 18 2025 11:35:08
Module start 'content'
Timing: Jan 18 2025 11:35:09
Module end 'content'
Timing: Jan 18 2025 11:35:09
Script end

Main resources:

Total runtime0.9038 sec
Peak memory usage4,096.0000 KB
Database Queries80

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 588.0469152.6406
Module start 'layout' 0.00760.0034 740.687539.4766
Module start 'content' 0.01100.8914 780.1641759.9609
Module end 'content' 0.90240.0014 1,540.125020.1250
Script end 0.9038  1,560.2500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3765160.0002
Check MTime0.00140.1520160.0001
Mysql Total
Database connection0.00080.089610.0008
Mysqli_queries0.820090.7292800.0103
Looping result0.00080.0930780.0000
Template Total0.873096.620.4365
Template load0.00190.208020.0009
Template processing0.871196.378220.4355
Template load and register function0.00020.023610.0002
states
state_id_array0.00090.097110.0009
state_identifier_array0.00080.090620.0004
Override
Cache load0.00180.1996830.0000
Sytem overhead
Fetch class attribute can translate value0.00080.084360.0001
Fetch class attribute name0.00200.2210110.0002
XML
Image XML parsing0.00400.439060.0007
class_abstraction
Instantiating content class attribute0.00000.0026120.0000
General
dbfile0.00310.3477260.0001
String conversion0.00010.007540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs