azurepdf.net-coreselectpdf

SelectPdf - NET Core 3.1 - Failed to convert HTML to PDF on Azure App Service


I have a .NET Core 3.1 web app running on Azure App Service that is using SelectPdf to convert some HTML document to PDF. It is working perfectly on my localhost but once I publish on to Azure, I got the following error no matter how small/simple my HTML document is:

System.Exception: Could not get conversion result header. Data transfer error. Data transmission error 109
   at SelectPdf.HtmlToImage.ᜀ(String A_0, String A_1, String A_2, ជ& A_3, String& A_4)
   at SelectPdf.HtmlToPdf.ᜁ(String A_0, String A_1, String A_2, String A_3, Boolean A_4)
   at SelectPdf.HtmlToPdf.ConvertHtmlString(String htmlString)

My current app service is on the basic Dev/Test plan (does this even matter)?


Solution

  • Disclosure: I work for SelectPdf.

    I am afraid that it matters what plan you are using on Azure. Azure has a lot of limitations and SelectPdf uses an alternate rendering engine on Azure. To test it on your computer, you need to set:

    GlobalProperties.EnableRestrictedRenderingEngine = true;
    

    SelectPdf requires an Azure App Service Plan starting with Basic (does not work with Free/Shared plans).

    More details about deployments to Azure can be found here: https://selectpdf.com/docs/SelectPdf-Microsoft-Azure.htm