Has anyone had success with centering or spanning the entire PDF with a header image? When I add a header image with the code below, it is always left aligned no matter if I use the align attribute (which says it is for text) or if I increases the width of the image (it appears to be cropped).
<cfhtmltopdfitem type="header" image="pathto/simple_head.png" />
I would like to use the Coldfusion to PDF capability because I need to deliver my user accessible PDF's on demand.
@jfkerwin , you're right. I have verified that ColdFusion doesn't respond to the align attribute when the header or footer is an image. Only when the header or footer's content is text.
Counterintuitive, yes. But we should perhaps have expected it. The cfhtmltopdfitem documentation says the align attribute is for "Alignment of the text".
We've been using WKHTMLTOPDF for all PDF generation (since ColdFusion 9) and when centering any images, we use HTML and a DIV with "margin:0 auto;". (I'm sharing this because I understand that CFHTMLTOPDF is black-boxed version of an older version of WKHTMLTOPDF.)
I would second Jamo 's suggestion. But if, for what ever reason, you're stuck with cfhtmltopdf or if the project has to be delivered urgently, then you could work around the problem as follows: