I’ve read all the other threads and tried everything. Here’s where I’m at:
Constructor:
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'ISO-8859-1', false);
I’m running utf8_encode on the buffer before doing writeHTML.
I have tried € the exact reference, pasting the character raw, changing the constructor to UTF8 seems to add random A’s with accents on around my document…
Not sure at this point.
My other question is styling using writeHTML… I have tables because TCPDF’s writeHTML function doesn’t really include the box model seemingly. For instance I have this code:
<td valign="top" align="left" style="padding:0;">
<table width="193" cellpadding="0" cellspacing="0">
<tr><td style="text-align:left;" align="left" valign="top" width="193" style="width:193px;">
<?php
$imageCount = count($theImages);
for($i = 1; $i <= $imageCount; $i++)
{
$f = SITE_ROOT . '/i/properties/'. $p->id .'/l_'. $theImages[$i]['name'];
$u = '/i/properties/'. $p->id .'/l_'. $theImages[$i]['name'];
if(file_exists($f)) {
echo '<img src="'.$u.'" width="193" /></td></tr><tr><td>';
}
}
?></td></tr></table>
</td>
Just an extract, and the first image is aligned to the eft, even though it’s all 193? I have spent a fair day or two on this so far, and if anyone has any alternatives for creating nicely styled property data sheets, integrating with a content managed php site, please let me know! 🙂 Otherwise any answers to my problems would be great.
You create your PDF using the encoding
ISO-8859-1which has the distinct disadvantage of not having the Euro sign. You can eitherISO-8859-15(which is compatible withISO-8859-1but has the Euro sign)or
UTF-8and make sure, all your text ist correctly encoded toUTF-8before throwing it at the PDF generator