I'm trying to configure the ABCpdf PDF Generator to run in an Azure App Service and I can get it to generate a simple Hello World pdf but as soon as I try to convert html to pdf with their Gecko engine I never get a response.
The response from Azure is 500 request timed out.
Here's the Hello World Code:
public FileResult HelloWorld()
{
activateLicense();
Doc doc = new Doc();
doc.AddText("Hello World");
byte[] data = doc.GetData();
return File(data, "application/pdf", "hw.pdf");
}
Here's the html to PDF Code:
public FileResult GooglePDF()
{
activateLicense();
byte[] pdfbytes;
using (Doc theDoc = new Doc())
{
theDoc.HtmlOptions.Engine = EngineType.Gecko;
theDoc.AddImageUrl("http://google.com");
pdfbytes = theDoc.GetData();
}
return File(pdfbytes, "application/pdf", "GoogleHomepage.pdf");
}
Example:
http://abcpdfazure.azurewebsites.net/
Source Code:
https://github.com/andyrblank/ABCpdfAzure
In regards to this question being a duplicate of this one: ABCpdf .NET with Azure App Service
The fundamental difference, in my question, is that I'm using the Gecko engine instead of the MSHtml engine. The Gecko engine does not require Windows Registry modification or for Internet Explorer to be installed on the host.
Engine doc: http://www.websupergoo.com/helppdfnet/source/5-abcpdf/xhtmloptions/2-properties/1-engine.htm
I do have this additional information on how ABCpdf works from the makers:
ABCGecko runs in a process pool so we need to be able to spawn worker processes
I believe that's referring to the ABCGeckoWP.exe file that uses the Gecko/Firefox rendering engine inside the XULRunner folder. I'm not sure if this is possible in Azure or if someone has a workaround.