如何使DOMPDF逐步支持Unicode字体? [英] How to make DOMPDF support unicode font step by step?

查看:56
本文介绍了如何使DOMPDF逐步支持Unicode字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了DOMPDF库,现在我对Unicode语言的内容有疑问。并且我发现了这一个 dompdf帮助
,但我没有不了解这一点。谁能告诉我这个细节?
谢谢

I used DOMPDF library and now I have problem with content with unicode language. and I found this one dompdf help but I don't understand about this. can anyone tell the detail of this? thanks

推荐答案


  1. 启用 mbstring扩展

  2. .ttf中查找字体格式并带有支持您给定语言的字符

  3. 为DOMPDF生成 .afm 文件:

  1. Enable the mbstring extension
  2. Find a font in .ttf format with characters that support your given language
  3. Generate a .afm file for DOMPDF:

  1. 使用命令行 cd 进入包含 load_font.php ,然后运行 php load_font.php FontName /path/to/font.ttf

  2. 使用在线工具,填写表格并下载提供给您的zip文件。将文件从此zip复制到 dompdf / lib / fonts 。如果您之前已完成此操作,则将相关行添加到 dompdf_font_family_cache ,否则只需将 dompdf_font_family_cache.sample 重命名为 dompdf_font_family_cache

  1. Using the command line, cd into the directory which contains load_font.php, then run php load_font.php FontName /path/to/font.ttf
  2. Using the online tool, fill out the form and download the zip it gives you. Copy the files from this zip into dompdf/lib/fonts. If you've done this before, add relevant lines to dompdf_font_family_cache, otherwise simply rename the dompdf_font_family_cache.sample to dompdf_font_family_cache


  • 通过确保该行启用DOMPDF的Unicode模式

  • Enable DOMPDF's Unicode mode, by making sure the line

    define("DOMPDF_UNICODE_ENABLED", true);
    

    设置在 dompdf_config.inc.php 中。如果它显示的是 false 而不是 true ,请进行更改。

    is set in dompdf_config.inc.php. If it reads false instead of true, change that.

    这篇关于如何使DOMPDF逐步支持Unicode字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆