问题描述
我使用从
建议的解决方案是:使用dompdf v.0.6.2 strong>但这里没有这样的版本:
帮助我,如果你能得到v.0.6.2
在UTF-8编码方面似乎有问题。我用dompdf试过了你的示例,我遇到了同样的问题。不过,我也尝试过使用(也是免费的),它似乎运作良好。
<?php
header('Content-type:text / html; charset = UTF-8'); // chrome
require_once('tcpdf.php');
//创建新的PDF文档
$ pdf =新的TCPDF(PDF_PAGE_ORIENTATION,PDF_UNIT,PDF_PAGE_FORMAT,true,'UTF-8',false);
$ pdf-> setFontSubsetting(true);
$ pdf-> SetFont('freeserif','',12);
$ pdf-> AddPage();
$ utf8text ='
< html>< head>
< p>தமிழ்< / p>
< / body>< / html>';
$ pdf-> writeHTML($ utf8text,true,0,true,true);
$ pdf->输出('example_008.pdf','I');
?>
I am using DOMPDF v.0.6.1 downloaded from github to convert HTML to PDF file. I am facing fontdisplay issue with while adding my custom font in configuration. dompdf_font_family_cache.dist.php
I used http://eclecticgeek.com/dompdf/load_font.php to generate Unicode TAMIL font(latha by microsoft font) .I have copied the fonts into respective folders.
But I see the fonts are not printing as it is.
My code:
<p style="font-family: tamil-latha, verdana, sans-serif;" >தமிழ்</p>
But what is printed in PDF is :
Both the values are not Same. There is some box is coming near the font and a dot on last character is missing..
Note: I have also added newly created font into dompdf_font_family_cache.dist.php
'tamil-latha' =>
array (
'normal' => DOMPDF_FONT_DIR . 'latha',
'bold' => DOMPDF_FONT_DIR . 'latha',
'italic' => DOMPDF_FONT_DIR . 'latha',
'bold_italic' => DOMPDF_FONT_DIR . 'latha',
),
I have raised the same question in github here : https://github.com/dompdf/dompdf/issues/838
Suggested Solution was: use dompdf v.0.6.2 But there is no such version available here : https://github.com/dompdf/dompdfHelp me if you are able to get v.0.6.2
Dompdf appears to have issues with UTF-8 encoding. I tried your sample with dompdf and I ran into the same issue you did. However, I also tried it with tcpdf (also free) it appears to work well.
Here is the code for your sample, and the full source can be downloaded here.
<?php
header('Content-type: text/html; charset=UTF-8') ;//chrome
require_once('tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setFontSubsetting(true);
$pdf->SetFont('freeserif', '', 12);
$pdf->AddPage();
$utf8text = '
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body>
<p>தமிழ்</p>
</body></html>';
$pdf->writeHTML($utf8text, true, 0, true, true);
$pdf->Output('example_008.pdf', 'I');
?>
这篇关于PHP DOMPDF html到PDF转换器的字体呈现问题在v.0.6.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!