使用jsreport与其他语言(不是英文)

我需要生成PDF报告,但问题是我不能用波斯语言渲染,简单的例子:

var http = require('http'); var jsreport = require('jsreport'); http.createServer(function(req, res) { jsreport.render({ template: { content: "<h2>سلام</h2>",// means "hello" in persian engine: 'jsrender', recipe: 'phantom-pdf' } }) .then(function(out) { out.stream.pipe(res); }).catch(function(e) { res.end(e.message); }); }).listen(3031, '127.0.0.1'); 

生成的PDF包含错误和不可读的任何想法? 感谢您的任何build议。

从文档

为了能够将正确的国家字符打印到PDF中,您需要首先在您的html中设置utf-8字符集。

 <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body> سلام </body> </html> 

游乐场的例子在这里