Page 1 of 1

PDF generation

Posted: Mon Feb 04, 2008 4:52 am
by dillion
Anybody using DOMPDF? I have used it for quite a while and it worked pretty well until I need to add dynamic images and content. I noticed that the image alignment does not work e.g.

Code: Select all

<img src="someimage.jpg" height="200" width="400" align="right" />
The HTML template itself is XHTML validated, and the page works fine in browser but when converted to PDF, the text is not wrapped around the image. Instead the image is moved down to new paragraph. :(

I think I nailed the issue down to "attribute_translator.cls.php" file

Code: Select all

'img_inner' => // img tags actually end up wrapping img_inner elements 
array ('align' => array('bottom' => 'vertical-align: baseline;', 
'middle' => 'vertical-align: middle;', 
'top' => 'vertical-align: top;', 
'left' => 'float: left;', 
'right' => 'float: right;'), 
'border' => 'border-width: %0.2f px;', 
'height' => 'height: %s;', 
'hspace' => 'padding-left: %1$0.2f px; padding-right: %1$0.2f px;', 
'vspace' => 'padding-top: %1$0.2f px; padding-top: %1$0.2f px',  
'width' => 'width: %s;', 
),
I don't know what the author meant by "img tags actually end up wrapping img_inner elements". Documentation is a bit bare and no responses at SourceForge forum.

Re: PDF generation

Posted: Mon Feb 04, 2008 12:48 pm
by Christopher
Have you looking a the DomPDF site. I recall they have a list of workarounds for things like this.

Re: PDF generation

Posted: Wed Feb 06, 2008 4:48 am
by dillion
Cheers for the response - yep already been to DOMPDF website, looked in FAQ, Usage, Samples, etc. and unfortunately couldn't see anything about the image alignment.

Do you use DOMPDF? If so, were you able to get your text to wrap around images?