Does iText (any version) work on Windows Azure web

2019-01-24 21:34发布

问题:

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.

回答1:

There are many limitations with the Azure App Service (formerly websites), so I was wondering if iText's PDF creation tools still worked.

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).