1

I really like html2pdf, it's great but I ran into one (I hope fixable) problem:

I use UTF-8 characters like č, š, ž,... but they are not shown in PDF.

I tried using utf8_decode and iconv but those characters are never shown - always replaced by ? or some other weird character. How can I fix this that I will be able to use UTF-8 characters?

2

have you tried with the UTF8 example ?
Ancien pseudo : lolo

3

I can't find UTF-8 example among files, the only one which I found was on website, but I cant get the source of it.

4

Oh, I just noticed I used older version. I will try with new one and I hope that it will work smile

5

It's better, words Š and Ž are recognized but Č is still replaced with "?". How can I fix this?

This is how my code looks like now:

		ob_start();
		include(dirname(__FILE__).'/pdf.php');
		$content = ob_get_clean();
		require_once(dirname(__FILE__).'/pdf/html2pdf.class.php');
		$html2pdf = new HTML2PDF('P','A4','en', true, 'UTF-8');
		$html2pdf->pdf->SetDisplayMode('real');
		$html2pdf->setDefaultFont('Times');
		$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
		$html2pdf->Output('pdf1.pdf', 'F');


Another thing, if I use as in example:
		$content = file_get_contents(dirname(__FILE__).'/pdf.php');
		$content = '<page style="font-family: freeserif"><br />'.nl2br($content).'</page>';


Then php code is ignored, it's shown in PDF instead of executed code... So this is probably used just for txt?

6

file_get_contents get the content of the file, it does not execute the php wink

about "Č", try directly with TCPDF. If it works, then the pb is with HTML2PDF. If it does not works, the pb is with TCPDF.
Ancien pseudo : lolo

7

It works now, there was a problem with font "$html2pdf->setDefaultFont('Times');", which doesn't support that character. Is there any way to add that character to that font?

8

the font "times" in TCPDF is not a UTF8 font. You must use a UTF8 font smile
Ancien pseudo : lolo

9

Is there any list of UTF8 supported fonts?

10

ther is only one UTF8 font on the package. If you want another font, you must build it

http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:font
Ancien pseudo : lolo

11

would $html2pdf->setDefaultFont('arialunicid0'); include most the Asian character I gonna need?

update:

I tested arialunicid0 and it uses Japanese font to display my Chinese characters... how do I change it back to Chinese font set?

12

you have to build a specific font for chinese.

http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:font
Ancien pseudo : lolo