How to make DOMPDF support unicode font step by st

2019-04-10 22:42发布

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

4条回答
成全新的幸福
2楼-- · 2019-04-10 23:20

As of version 0.7, dompdf supports and has unicode enabled by default. (therefore there is no need for configuration).

Not all dompdf fonts support unicode though. I used font-family: DejaVu Sans with success.

To install a custom font or learn more about it you can read the official unicode how to.

查看更多
淡お忘
3楼-- · 2019-04-10 23:25

There is a wiki page for this.

The next beta (0.6 beta 3), to be released soon, has a font installer that doesn't require the command line (neither any compilation). You already can use it by checking out the SVN trunk. This beta also supports @font-face.

查看更多
ら.Afraid
4楼-- · 2019-04-10 23:27

try to manipulate your code using this recommended DOMPDF method it's a A guide to enabling Unicode support in DOMPDF To ensure maximum compatibility you should follow all of the following steps. Click through for additional details. Ensure the MBString PHP extension is enabled Install dompdf 0.6.0 or greater Configure dompdf for Unicode support Load a font supporting your characters into dompdf Create a compatible HTML document see the link for more information

查看更多
Fickle 薄情
5楼-- · 2019-04-10 23:29
  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. 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 dompdf_font_family_cache.sample to dompdf_font_family_cache
  4. Enable DOMPDF's Unicode mode, by making sure the line

    def("DOMPDF_UNICODE_ENABLED", true);
    

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

查看更多
登录 后发表回答