We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Syncfusion.Pdf.PdfException: Html conversion failed

I'm using the webkit renderer/HTML converter to export my HTML and SVG diagram nodes to an image (details in this forum thread). 

On my local development machine, the solution works fine, whether packaged as asp.net core app (.net core 2.2, windows host) or as an azure functions app (.net core 2.2, windows host). 

However when deployed to azure, I encounter the following error: 

Syncfusion.Pdf.PdfException: Html conversion failed
   at Syncfusion.HtmlConverter.HtmlConverter.CheckConversionDone(String tempFilePath)
   at Syncfusion.HtmlConverter.HtmlConverter.ConvertToImage(String url)
   at Syncfusion.HtmlConverter.HtmlToPdfConverter.ConvertToImage(String url)
   at Syncfusion.HtmlConverter.HtmlToPdfConverter.ConvertToImage(String html, String baseurl)


I have checked that all the relevant dependencies (msvcp100.dll and msvcr100.dll) are actually installed on the host server (I checked via the portal console). 

Any clues why this error is occurring?

PS: I have also checked the following pages for clues, but nothing seemed to resolve the error on Azure.
https://www.syncfusion.com/kb/8208/failed-to-convert-the-webpage-exception-with-webkit-html-converter

14 Replies

MI Mithun October 15, 2019 09:50 AM UTC

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 Kumar October 16, 2019 07:33 AM UTC

Hi Mithun, 
 
Thank you for your update. We are glad to know that your reported issue has been resolved.  
 
Regards, 
Gowthamraj K 



AN Andy October 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?

Thanks


Gowthamraj Kumar October 31, 2019 10:42 AM UTC

Hi Andy, 

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.   

 

Regards, 
Gowthamraj K 



AN Andy November 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.

Thanks


Gowthamraj Kumar November 5, 2019 06:40 AM UTC

Hi Andy, 

Thank you for your update. We are glad to know that your reported exception has been resolved. 
 
Regards, 
Gowthamraj K 



MI Mithun December 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.

Thanks,
Mithun


Prakash Viswanathan December 20, 2019 05:20 AM UTC

Hi Mithun, 

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.  

Regards, 
Prakash V 



MI Mithun December 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

Thanks,

-Mithun




Prakash Viswanathan December 20, 2019 06:02 AM UTC

Hi Mithun, 

Yes, you can host the HTML to PDF converter in Azure app service Linux. Please refer below KB link for more information, 

Please let us know if you need any further assistance on this.  

Regards, 
Prakash V 



MI Mithun December 20, 2019 03:18 PM UTC

Thanks! That worked! 

Thanks,
-Mithun


Prakash Viswanathan December 23, 2019 05:39 AM UTC

Hi Mithun, 

Thank you for the update.  
Please let us know if you need any further assistance on this.  

Regards, 
Prakash V 



GO Gordon May 6, 2021 05:02 AM UTC

If you're using Azure DevOps to build/deploy, set the deployment method to: 'zipDeploy'.




Gowthamraj Kumar May 6, 2021 12:21 PM UTC

Hi Gordon,

 
Thank you for your update.   
 
Regards, 
Gowthamraj K 


Loader.
Live Chat Icon For mobile
Up arrow icon