将 jsreport 与其他语言一起使用(非英语)

use jsreport with other languages (not in English)

我需要生成 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 包含一些错误且不可读的内容,知道吗?感谢您的任何建议。

来自documentation

To be able to print correct national characters into pdf you need to set utf-8 charset in your html first.

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

游乐场示例here