以中文导出为PDF

时间:2019-05-27 02:21:55

标签: javascript kendo-ui kendo-grid

我有一个包含中文的表格。当我想将数据导出到PDF时会出现问题。似乎出现了一个奇怪的字符(下图)或类似的东西。谁能帮我解决问题?

Here I provide a DEMO in dojo

enter image description here

2 个答案:

答案 0 :(得分:0)

根据文档,https://demos.telerik.com/kendo-ui/grid/pdf-export为支持unicode,您需要使用自定义字体。您在线共享的代码未加载。

答案 1 :(得分:0)

使用kendo.pdf.defineFont

找到了解决方案
  1. 我需要下载Arial Unicode MS字体,然后放入文件夹中。
  2. 通过defineFont,我使用了这段代码。

mqttFunction(){
  var mqtt = require('mqtt');
  var client = mqtt.connect([{host: 'localhost', port: '1883'},]);

  client.subscribe('presence')
  client.on('message', function (topic, message) {
  console.log(message);
});  
}

希望这会有所帮助。

相关问题