2

Using EvoPDF for a .Net web application works locally, however once deployed to a Microsoft Azure website it throws a generic exception: "unable to render html".

Stack trace:

[Exception: Could not render the HTML string.]
   EvoPdf.HtmlToImageConverter.ᜀ(String A_0, String A_1, String A_2, ᜴& A_3, Hashtable& A_4) +2129
   EvoPdf.HtmlToPdfConverter.ᜀ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) +8369
   EvoPdf.HtmlToPdfConverter.ᜀ(Stream A_0, String A_1, String A_2, String A_3, String A_4, Boolean A_5) +58
   EvoPdf.HtmlToPdfConverter.ᜁ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) +126
   EvoPdf.HtmlToPdfConverter.ConvertHtml(String htmlString, String baseUrl, String internalLinksBaseUrl) +33
   EvoPdf.HtmlToPdfConverter.ConvertHtml(String htmlString, String baseUrl) +12
   td.Printing.Labels.Print.WithEvoPdf(HttpContext httpContext, Action`1 htmlPageRenderer, String outputFileName, Label labelFormat) in C:\...\Evo PDF Print Labels.vb:54
   td.OL3016WR.Render(HtmlTextWriter writer) in C:\...\OL3016WR.aspx.vb:166
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8921
Le-roy Staines
  • 2,037
  • 2
  • 22
  • 40

4 Answers4

2

You've hit an Azure App Service sandbox runtime exectution limitation.

From https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks:

Unsupported frameworks

Here is a list of frameworks and scenarios that have been found to be not be usable due to one or more of the restrictions above. It's conceivable that some will be supported in the future as the sandbox evolves.

PDF generators failing due to restriction mentioned above:

EVOPDF
Rotativa
wkhtmltopdf
Syncfusion
Siberix
NReco (uses wkhtmltopdf)
Spire.PDF

Other scenarios:
PhantomJS/Selenium: tries to connect to local address, and also uses GDI+.

As you already mentioned this works fine in a Web/Worker Role (Cloud Services). Service Fabric or IaaS VM are other options.

evilSnobu
  • 24,582
  • 8
  • 41
  • 71
  • Thanks for the detail! :) – Le-roy Staines Jul 25 '16 at 18:36
  • @evilSnobu i am also having same problem.. Service fabric is valid option here? Means only for PDF generation is it feasible.. – DevPerson May 10 '19 at 10:25
  • You have way more options now, check out Azure Container Instances with Windows containers and App Service with Windows containers. Azure Logic Apps also has steps to generate PDF from different sources. – evilSnobu May 10 '19 at 12:48
1

EvoPdf has a solution for Azure Websites. Check the http://www.evopdf.com/azure-html-to-pdf-converter.aspx page for more details.

EvoPdf
  • 523
  • 3
  • 9
0

Found the general cause. Something about EvoPDF is not compatible with Azure websites. In a cloud services web role it works OK.

Le-roy Staines
  • 2,037
  • 2
  • 22
  • 40
0

I dissed Debenu unjustly. Ended up I was having problem with kernel32 LoadLibrary on the azure server. On my local machine it would take a relative path and find the dll. On azure I had to give it full path and it ran fine. Did not try the gdi+ renderer but 2, cairo worked fine.

To be compliant and provide an answer make sure you send a full path to loadLibrary and choose renderer 2. All good.

FairSite2C
  • 81
  • 3
  • 7