PDF generation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dillion
Forum Commoner
Posts: 56
Joined: Thu Feb 15, 2007 8:32 am

PDF generation

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PDF generation

Post by Christopher »

Have you looking a the DomPDF site. I recall they have a list of workarounds for things like this.
(#10850)
dillion
Forum Commoner
Posts: 56
Joined: Thu Feb 15, 2007 8:32 am

Re: PDF generation

Post 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?
Post Reply