iText(任何版本)是否适用于Windows Azure网站?

Jes*_*rks 3 itext azure-web-sites itext7

Azure App Service(以前称为网站)存在许多限制,因此我想知道iText的PDF创建工具是否仍然有效.具体来说,我将HTML转换为PDF,包括各种风格和图像.

由于其局限性,rotativa和Pechkin都无法在Azure App Service上工作.

Fei*_*Han 5

Azure App Service(以前称为网站)存在许多限制,因此我想知道iText的PDF创建工具是否仍然有效.

基于我的测试和以下示例,我可以使用iText 7生成PDF文件,它可以在Azure App Service Web App上正常工作.

var path = Server.MapPath("test.pdf");

FileInfo dest = new FileInfo(path);

var writer = new PdfWriter(dest);
var pdf = new PdfDocument(writer);
var document = new Document(pdf);
document.Add(new Paragraph("hello world"));
document.Close();
Run Code Online (Sandbox Code Playgroud)

生成的PDF:

在此输入图像描述

此外,我正在使用iText的基本功能,它在Azure Web App沙箱上运行良好.如果iText的任何高级功能无法在沙箱上运行,您可以尝试其他托管选项(例如云服务,虚拟机).