Ok, I figured out the solution. On Azure you'll have to ensure that the web app (or function app) runs in 64 bit mode (please see screenshot below).
Gowthamraj KumarOctober 16, 2019 07:33 AM UTC
Thank you for your update. We are glad to know that your reported issue has been resolved.
ANAndyOctober 31, 2019 07:50 AM UTC
I'm evaluating syncfusion html to pdf conversion running as a azure function app. I deployed the project from https://www.syncfusion.com/kb/10301/how-to-convert-html-to-pdf-in-azure-functions-2-0 to see if it works, but the azure function throws the exception "Syncfusion.Pdf.PdfException: Html conversion failed".
I tried changing the platform settings to 64 bit, but the exception is still getting thrown. I also tried several plans. It fails with Basic, Standard and ElasticPremium app service plans.
Can you verify if this sample project still runs as an azure function app? And what settings are needed in azure?
Gowthamraj KumarOctober 31, 2019 10:42 AM UTC
We have checked the HTML to PDF conversion in Azure Function app and it is working properly. We suspect that the reported exception may occurs when enabling run from package file option when creating a publish target. Please refer below screenshot,
We tried without enabling run from package file option and it is working properly (refer below screenshot). When we publish the azure function with run from package option, the function only has read only permission. But for converting HTML to PDF, we internally launch the browser process from QtBinariesWindows folder. Due to the read only permission, the converter unable to launch the browser process. So, the HTML conversion getting failed. Can you please try the conversion by publishing without run from package option and let us know the result.
ANAndyNovember 4, 2019 10:52 AM UTC
I disabled the option "run from package" and the function works now! So there is no need to change the platform settings.
Gowthamraj KumarNovember 5, 2019 06:40 AM UTC
Thank you for your update. We are glad to know that your reported exception has been resolved.
MIMithunDecember 19, 2019 04:03 PM UTC
Can anyone confirm whether the solution will work in an consumption plan of azure functions (windows)?
I've been trying to get it to work, but function times out while calling HtmlToPdfConverter.ConvertToImage()
I see from Gowthamraj's comments in this article's thread that consumption plan is not supported for this solution. Just wanted to check whether anything has changed since then.
Prakash ViswanathanDecember 20, 2019 05:20 AM UTC
No, due to the limitations on Azure consumption plan, the HTML converter will not work with consumption plan on Azure function. Kindly try the conversion with basic (B1) or higher plans for converting HTML to PDF/Image on Azure function.
Please let us know if you need any further assistance on this.
MIMithunDecember 20, 2019 05:51 AM UTC
Thanks Prakash for confirming.
One final question. I'd like to host the html -> pdf converter on azure app service for linux.
Are there any code-samples or syncfusion knowledgebase article for this? I have seen the samples for app service for windows, but am trying to get this working on app service for linux.
Prakash ViswanathanDecember 20, 2019 06:02 AM UTC
Yes, you can host the HTML to PDF converter in Azure app service Linux. Please refer below KB link for more information,