问题描述
Azure App Service(以前称为网站)存在许多限制,因此我想知道iText的PDF创建工具是否仍然有效。具体来说,我将HTML转换为PDF,包括各种样式和图像。
由于受限制,rotativa和Pechkin都不能在Azure App Service上工作。
根据我的测试以下示例,我可以使用
此外,我使用的是iText的基本功能,它在。如果iText的任何高级功能无法在沙箱上运行,您可以尝试其他托管选项(例如云服务,虚拟机)。
There are many limitations with the Azure App Service (formerly websites), so I was wondering if iText's PDF creation tools still worked. Specifically, I will be converting HTML to PDF, including all manner of styles and images.
Neither rotativa nor Pechkin work on Azure App Service due to its limitations.
Based on my test with following sample, I can use iText 7 to generate PDF file, and it works fine on 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();
Generated PDF:
Besides, I am using the basic feature of iText, which works fine on Azure Web App sandbox. If any advanced features of iText can not work on sandbox, you can try another hosting options (such as Cloud Services, Virtual Machines).
这篇关于iText(任何版本)是否适用于Windows Azure网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!