fs.readFileSync 错误
fs.readFileSync Error
我正在尝试使用 html-pdf 节点模块从 html 生成 pdf。我目前 运行 使用 cloud9 IDE。
我的代码是:
var fs = require("fs");
var pdf = require('html-pdf');
var html = fs.readFileSync('./test.html', {encoding: 'utf8'});
var options = { format: 'Letter' };
app.post('/pdf',function(req, res) {
pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {
if (err) return console.log(err);
console.log(res); // { filename: '/app/businesscard.pdf' }
});
});
我收到以下错误:
[Error: Fontconfig warning: ignoring C.UTF-8: not a valid language tag]
有谁知道我该如何解决这个问题?
This is due to a bug in fontconfig
. You can see here
打开您的终端并执行 locale -a
您将看到 fonts
的列表。然后 select 它喜欢 LC_ALL=C
可能有帮助
我正在尝试使用 html-pdf 节点模块从 html 生成 pdf。我目前 运行 使用 cloud9 IDE。
我的代码是:
var fs = require("fs");
var pdf = require('html-pdf');
var html = fs.readFileSync('./test.html', {encoding: 'utf8'});
var options = { format: 'Letter' };
app.post('/pdf',function(req, res) {
pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {
if (err) return console.log(err);
console.log(res); // { filename: '/app/businesscard.pdf' }
});
});
我收到以下错误:
[Error: Fontconfig warning: ignoring C.UTF-8: not a valid language tag]
有谁知道我该如何解决这个问题?
This is due to a bug in
fontconfig
. You can see here
打开您的终端并执行 locale -a
您将看到 fonts
的列表。然后 select 它喜欢 LC_ALL=C
可能有帮助