繁体   English   中英

Dompdf无法在PDF中呈现INR符号

[英]Dompdf not rendering INR symbol in PDF

我在尝试使用INR货币符号时遇到dompdf问题 我已经在本地服务器上使用Dejavu Sans font family解决了该问题。 但是,当我将文件上传到实时服务器时,它只会生成一个? 代替INR symbol 我尝试了许多方法,例如包括使用'Currencies'字体家族提供@fontface{...}代码, define("DOMPDF_UNICODE_ENABLED",true) ,但这种方法不起作用。

require_once 'class-my-pdf-creator.php';
$dompdf = new my_pdf_obj();
define("DOMPDF_UNICODE_ENABLED", true);
$dompdf->set_option('isHtml5ParserEnabled', true);
$dompdf->loadHtml('<style>@font-face {
  font-family: "DejaVu Sans";
  font-style: normal;
  font-weight: normal;
}</style><span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span>');
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
$dompdf->set_option('font_subsetting', true);
// Render the HTML as PDF
$dompdf->render();
$dompdf->stream();

Dompdf 0.6.x及更高版本支持不同的编码。

显示INR的最简单方法是将文档编码为UTF-8 然后,您可以引用INR符号。

在您的HTML中添加以下语句:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

将以上内容添加到HTML中后,您可以使用以下代码显示INR符号:

<span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM