dompdf character encoding UTF-8

后端 未结 11 2026
我在风中等你
我在风中等你 2020-12-01 21:07

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 t

11条回答
  •  情深已故
    2020-12-01 21:25

    I had similar problem and ended up using tcpdf.Hope this could be helpful. http://www.tcpdf.org/
    Problem was the font i was using.I was able to get the correct output using this font 'freeserif'.I guess it might be possible to get the same output using this font with dompdf.

    $pdf->SetFont('freeserif', '', 12);
    

    Here is the sample i have used. tcpdf utf-8 sample

    setFontSubsetting(true);
    
    $pdf->SetFont('freeserif', '', 12);
    
    $pdf->AddPage();
    
    $utf8text = '
      
    
    Ponuka číslo € černý Češký 
    සිංහල
    தேமல
    '; $pdf->SetTextColor(0, 63, 127); $pdf->writeHTML($utf8text, true, 0, true, true); $pdf->Output('example_008.pdf', 'I'); ?>

提交回复
热议问题