4

I'm using TCPDFs writeHTML to convert some html-code into a pdf. This works fine so far except that the checkmark (&#x2713) is converted into a questionmark instead of... well, a checkmark ;-) The PDF is created as UTF-8, but neither feeding the checkmark itself nor the hex-representation resulted in showing the correct checkmark. I tried to used the fonts Helvetica and Times, shipped with TCPDF, but both only display ?. Any idea how to get the checkmark into the PDF?

3
  • Try with the checkboxes unicode character: U+2713
    – Daan
    Commented Jun 1, 2015 at 9:59
  • Thanks for your reply. This is what I meant by "feeding the checkmark itself" - which unfortunately doesn't work.
    – Werner
    Commented Jun 1, 2015 at 10:15
  • is there any answer to this question.
    – Bugfixer
    Commented Feb 1, 2016 at 6:23

3 Answers 3

8

@Nuno answer was a huge help. For those wondering, the writeHTML equivalent (as asked by OP) is :

<span style="font-family:zapfdingbats;">3</span>
0
2

Old post but it may help others. Use the font zapfdingbats and the number 3 or 4.

$pdf->SetFont('zapfdingbats', '', 14);
$pdf->writeHTMLCell(80, 10, 10, 9, '3', $border=1, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true);

Check the last example https://tcpdf.org/examples/example_055/

0

try this one

html_entity_decode('&#x2713;', ENT_XHTML,"ISO-8859-1");
1
  • Anyone able to get this method to work? More appealing than changing the font for every instance. I made an attempt a couple different ways, by calling this direct with the MultiCell() method, assigning to a variable etc... can't seem to figure it out. Commented Mar 21, 2018 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.