Wht是将HTML转换为PDF的最佳解决方案(在Azure Web应用程序上) [英] Wht is the best solution for HTML to PDF (on Azure Web app)

查看:115
本文介绍了Wht是将HTML转换为PDF的最佳解决方案(在Azure Web应用程序上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我正在尝试使用NReco PDF转换器将html内容转换为pdf,但是,这行代码pdfDoc.GeneratePdf(HtmlContent); 无法通过Azure Web应用进行访问,但在我的开发环境中正常运行.所以我的问题是我应该选择哪种云服务?

Actually I am trying to convert html content to pdf using NReco PDF converter, however, this line of code pdfDoc.GeneratePdf(HtmlContent); unable to get through on Azure web app, but it works normally on my dev environment. So my Question is which cloud service should i go for?

推荐答案

Azure Apps(以前的WebSites)在受限(部分信任)环境中运行,并且wkhtmltopdf.exe(NReco PdfGenerator包装器内部使用)无法在以下环境中执行这种情况直接来自asp.net应用程序.

Azure Apps (former WebSites) operate in restricted (partial-trust) environment and wkhtmltopdf.exe (that is internally used by NReco PdfGenerator wrapper) cannot be executed in this case directly from asp.net application.

更新:

不幸的是,它也不适用于Azure WebJob:在与WebSite相同的(受限)环境下执行任务,并且禁用了wkhtmltopdf使用的GDI功能.

Unfortunately it will not work with Azure WebJobs as well: tasks are executed under the same (limited) environment as WebSites and GDI functions used by wkhtmltopdf are disabled.

如果您的ASP.NET应用程序使用基于wkhtmltopdf的组件生成PDF(无论调用方式如何-在单独的过程中还是作为本机DLL API),它将仅在Azure WebRole/WorkerRole/VM下工作.

If your ASP.NET app uses wkhtmltopdf-based component for PDF generation (doesn't matter how it is invoked - in separate process or as native DLL API) it will work only under Azure WebRole / WorkerRole / VM.

-更新2017年-

Wkhtmltopdf(和NReco PdfGenerator包装器)可以与基于VM的订阅计划(基本或更高版本)的Azure Apps一起使用.至少仍然存在一个问题:似乎字体API仍然受到限制,并且自定义字体无法呈现为PDF.

Wkhtmltopdf (and NReco PdfGenerator wrapper) can be used with Azure Apps with VM-based subscription plan (Basic or higher). At least one issue still exists: it seems fonts API is still restricted and custom fonts cannot be rendered to PDF.

这篇关于Wht是将HTML转换为PDF的最佳解决方案(在Azure Web应用程序上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆