node.js - 我在 Azure 上有这些模块,为什么我收到 Recipe phantom-pdf was not found.?

标签 node.js pdf azure phantomjs jsreport

我在 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/

相关文章:

objective-c - PDFPage 的分辨率?

php - 从 Base64 字符串下载 PDF

asp.net-mvc - 如果我的应用程序使用 Azure "Easy Auth",如何向 Microsoft Graph 进行身份验证

azure - 减少网站中 Azure 消耗的最佳实践

javascript - 使用 AJAX 在 Node.js 上进行数据库查询

javascript - 引用错误 : document is not defined in Nodejs

.net - C# 或 .net 中是否有任何 API 可以编辑 pdf 文档?

iphone - Windows Azure 参数

javascript - xhr.getAllResponseHeaders() 只返回一个标题

node.js - 使用node.js从HTML解析JSON-LD微格式?