【问题标题】:"Cannot find module 'jsreport-core' azure" error after publishing ASP.NET Core MVC 2.0 to Azure将 ASP.NET Core MVC 2.0 发布到 Azure 后出现“找不到模块 'jsreport-core' azure”错误
【发布时间】:2018-09-10 12:37:45
【问题描述】:

如何在 ASP.NET Core MVC 2.0 中将 html 转换为 pdf?已经尝试过使用 pdf random,但它在 Azure 中发布后抛出错误。错误说

找不到模块 'jsreport-core' azure。

以下是使用的代码:

module.exports = function (callback, html) { 

    var jsreport = require('jsreport-core')()

    jsreport.init().then(function () { 
        return jsreport.render({ 
            template: { 
                content: newHtml, 
                engine: 'jsrender', 
                recipe: 'phantom-pdf',

            } 
        }).then(function (resp) { 
            callback(null, resp.content.toJSON().data); 
        }); 
    }).catch(function (e) { 
        callback(e, null); 
    }) 
};

此代码在未在 Azure 门户中发布时可以正常工作。发布后,它会抛出上述突出显示的错误。已经采取的一些步骤是: 将 node.exe 添加到根文件夹。部署后不知何故无法加载js库(jsreport-core,jsreport-core,phantom-pdf)。

【问题讨论】:

  • 嗨@SharadhaR,你能发布你的代码吗?这样就更容易帮助你了!
  • 点评来源:请添加您的源代码并用“.netcore”标签替换您的一些标签。
  • 添加源代码

标签: azure asp.net-core-mvc pdf-generation asp.net-core-mvc-2.0 jsreport


【解决方案1】:

此功能尚未在 asp.net core 2.0 中实现。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-26
    • 1970-01-01
    • 1970-01-01
    • 2018-07-30
    • 2020-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多