简体   繁体   English

无法通过TCPDF为某些特定的简体中文字符生成PDF

[英]Cannot generate PDF for some specific simplified chinese characters via TCPDF

I have an existing program (codes) to generate PDF file via TCPDF. 我有一个现有程序(代码),可通过TCPDF生成PDF文件。 It works fine even contain non-English characters in most cases, but now, when the content has either two simplified Chinese characters (unicode number: 21894) or (unicode number: 26107), all Chinese characters will be converted to rectangle (invalid character). 在大多数情况下,即使包含非英文字符也可以正常工作,但是现在,当内容具有两个简体中文字符 (统一码:21894)或 (统一码:26107)时,所有汉字都将转换为矩形(无效字符)。

I tried to check the uni2cid_ag15.php, and I can find the mapping of those two words and the mapped cids are correct. 我尝试检查uni2cid_ag15.php,发现这两个单词的映射和映射的cid是正确的。 Is anyone know the reason for converting the Chinese characters incorrectly with that specific character(s)? 有人知道用该特定字符错误地转换汉字的原因吗?

References: 参考文献:
https://raw.githubusercontent.com/adobe-type-tools/cmap-resources/master/cmapresources_gb1-5/cid2code.txt https://raw.githubusercontent.com/adobe-type-tools/cmap-resources/master/cmapresources_gb1-5/cid2code.txt
https://github.com/tecnickcom/TCPDF/blob/master/fonts/uni2cid_ag15.php https://github.com/tecnickcom/TCPDF/blob/master/fonts/uni2cid_ag15.php

Thanks for the advice in advance. 预先感谢您的建议。

I found out the solution by using new encoding "GB18030" for php function mb_convert_encoding, instead of "GB2312". 我通过为php函数mb_convert_encoding使用新的编码“ GB18030”而不是“ GB2312”找到了解决方案。 Those characters can be generated in the PDF without problem. 这些字符可以毫无问题地在PDF中生成。

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

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