wkhtmltopdf和汉字 [英] wkhtmltopdf and chinese characters

查看:114
本文介绍了wkhtmltopdf和汉字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用wkhtmltopdf生成PDF,但这给我显示所有字符带来很多麻烦.

Trying to generate a PDF with wkhtmltopdf but it gives me a lot of trouble displaying all the characters.

某些字符有效-例如打印时

Some of characters work - e.g. when printing

  • 发票编号(付款编号)"的中文字符1、2和4正确打印,但是3号字符在PDF中仅显示空白.
  • 客户编号(客户编号)"中的1号和4号汉字正确显示,而2号和3号汉字未显示在PDF中.
  • 总计(累计)"不会在生成的PDF中显示任何汉字.

我正在使用wkhtmltopdf版本"wkhtmltopdf 0.12.1(已修补qt)"的Ubuntu 14.04桌面系统.我已经安装了中文字体,并且所有字符都可以在系统上的gedit和Firefox中正确显示,但是wkhtmltopdf仅显示其中的75%.

I'm on a Ubuntu 14.04 desktop system with wkhtmltopdf version "wkhtmltopdf 0.12.1 (with patched qt)". I have installed the Chinese fonts and all the characters are correctly displayed in both gedit and Firefox on my system, but wkhtmltopdf only displayes about 75% of them.

我的HTML文档是用UTF-8字符集制成的,并且可以在Firefox和gedit中正确显示.我还尝试过使用

My HTML document is made in with UTF-8 character set and is correctly displayed in Firefox and gedit. I have also tried to embed the font-face directly in the style section of the header using the

src: url(data:font/ttf;base64,AAEA....)

标签将字体外观直接嵌入标题的样式部分中,并且wkhtmltopdf按预期方式更改了字体外观,但仍然缺少缺少的字符.

tag and wkhtmltopdf changes the font face as expected but the missing characters are still missing.

在我摆脱想法时,真的很感谢任何帮助.

Any help is really really appreciated as I'm getting out of ideas.

推荐答案

您是否已安装 查看全文

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