【问题标题】:Does iText (any version) work on Windows Azure websites?iText(任何版本)是否可以在 Windows Azure 网站上运行?
【发布时间】:2018-01-10 06:48:00
【问题描述】:

Azure 应用服务(以前的网站)有很多限制,所以我想知道 iText 的 PDF 创建工具是否仍然有效。具体来说,我会将 HTML 转换为 PDF,包括各种样式和图像。

rotativa 和 Pechkin 都不能在 Azure 应用服务上工作,因为它有局限性。

【问题讨论】:

    标签: itext azure-web-app-service itext7


    【解决方案1】:

    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();
    

    生成的 PDF:

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

    【讨论】:

    • 好像发了很久,但是你的套餐是基础高还是消费?
    猜你喜欢
    • 2021-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多