我在 Azure 上使用 npm 安装了 phantom-pdf 0.2.2、phantomjs 1.9.15 和 jsreports 0.2.3。我让 azure 在部署时使用 package.json 安装,但收到错误 Recipe phantom-pdf 未找到。当我走这条路线时:
app.route('/pdfreport')
.get(function (req, res) {
require('jsreport').render({
template: {
content: "blank",
phantom: {
url: "http://google.com",
orientation: "portrait",
width: "300px"
}
}
}).then(function(out) {
out.result.pipe(res);
}).fail(function(e) {
console.log(e);
});
});
我到底做错了什么?它适用于我的本地 Mac 和本地 Windows 计算机
最佳答案
恐怕 phantom-pdf 配方无法在 Azure 网站上运行,因为此共享托管环境阻止了渲染 pdf 所需的 GDI+ API。
您必须创建一个完整的虚拟机才能在 azure 中运行 jsreport。
关于node.js - 我在 Azure 上有这些模块,为什么我收到 Recipe phantom-pdf was not found.?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28589572/