最近在做一个用 DOMPDF 把 HTML 生成 PDF 的功能,解决了中文字体的支持,然后遇到了中文换行的一点问题。转换成 PDF 的 HTML 使用中文字体的话,不能自动换行。如图:
在 Google Groups 里看到一条评论:
Comment 7 by [email protected], Oct 24, 2009
@xjpmauricio:
Justification does not work with Unicode enabled (at least with
own-added/self-designed) fonts). This is more or less a problem of the PDF-Standard.
I'll post a more detailed description and a patch to the list once I find time to
clean it up...大意是另外添加的字体无法使用两边对齐,这个跟中文字体不能自动换行有关系么?参考链接:
http://code.google.com/p/dompdf/issues/detail?id=146
http://code.google.com/p/dompdf/issues/detail?id=14
http://code.google.com/p/dompdf/issues/detail?id=132