Im trying to create pdf with correct characters, but there are "?" chars.
I created a test php file, where Im trying to fing the best solution. If Im open in the browser the html I looks like ok
UTF-8 --> UTF-8 : X Ponuka ?íslo € ?erny ?e?ky
But when I look into the pdf I see this
UTF-8 --> UTF-8 : X Ponuka ?íslo € ?erny ?e?ky
Here is my all code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>? s ? ?</title>
</head>
<body>
<?php
require_once("dompdf/dompdf_config.inc.php");
$tab = array("UTF-8", "ASCII", "Windows-1250", "ISO-8859-2", "ISO-8859-1", "ISO-8859-6", "CP1256");
$chain = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style></style><title>? s ? ?</title></head><body>';
foreach ($tab as $i)
{
foreach ($tab as $j)
{
$chain .= "<br> $i --> $j : ".iconv($i, $j, 'X Ponuka ?íslo € ?erny ?e?ky <br>');
}
}
$chain .= '<p style="font-family: firefly, verdana, sans-serif;">??????X Ponuka ?íslo € ?erny ?e?ky <br></p></body></html>';
echo $chain;
echo 'X Ponuka ?íslo € ?erny ?e?ky <br>';
$filename = 'pdf/_1.pdf';
$dompdf = new DOMPDF();
$dompdf->load_html($chain, 'UTF-8');
$dompdf->set_paper('a4', 'portrait'); // change these if you need to
$dompdf->render();
file_put_contents($filename, $dompdf->output());
?>
</body>
</html>
What Im doing wrong? I tried many many options which I found :( Any idea?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…