欧卡2中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

需要三步,才能开始

只需两步,慢速开始

玩欧卡就用莱仕达V10方向盘欧卡2入门方向盘选莱仕达V9莱仕达折叠便携游戏方向盘支架欢迎地图Mod入驻
查看: 5823|回复: 0
收起左侧

解决dw2pdf导出文件中文乱码问题

[复制链接]
script 发表于 2012-11-19 11:57 | 显示全部楼层 |阅读模式
用dokuwiki写了篇文档,想要导出到pdf,于是装了dw2pdf,可是导出之后发现中文都是乱码。
搜索之后,只找到一篇关于问题的博文:http://xwz.me/blog/2011/03/15/dokuwiki_exportpdf/,可惜已经过时了,给的链接也不能用。
最后在官方文档中找到了答案,看来还是文档最全面。
在文档中搜索cjk,可以找到一些条目。
主要看两篇文档,第一个看到的是use_CJK_only
Note: DEPRACATED mPDF >= 5.0 See useAdobeCJK
$mpdf->use_CJK_only = true;
Use this if you are using a CJK codepage with only CJK/ASCII or embedded characters -this will prevent loading of Unicode fonts – keeping file size to a minimum
Ignored if not using a CJK codepage.
Default = false
根据提示找到了useAdobeCJK
(mPDF >= 5.0)
Description
boolean useAdobeCJK
When TRUE, forces mPDF to use the free Adobe CJK Asian fonts, thus keeping the PDF file size to a minimum. This affects text defines using the CSS lang property, which includes the use of AutoFont. Thus a CSS stylesheet defining lang=”ja” will be substituted by the Adobe Japanes font. (This will not prevent the use of other CJK fonts if specified by font-family.)
The precise effect it has on different languages/fonts will be specified in the config_cp.php configuration file.
Note: This value can only be set inside the config.php configuration file. To change the value at runtime, you must use $mpdf = new mPDF(‘-aCJK’); to set as FALSE or $mpdf = new mPDF(‘+aCJK’); to set as TRUE
Values
useAdobeCJK = TRUE|FALSE
Values
TRUE: DEFAULT Use the free Adobe CJK Asian fonts
FALSE: Use normal embedded fonts
然后修改mpdf/config.php,大致44行,将useAdobeCJK改为true:
1
$this->useAdobeCJK = true;                // Uses Adobe CJK fonts for CJK languages

之后导出中文正常!

联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )

GMT+8, 2024-4-26 20:07 , Processed in 0.037589 second(s), 6 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表