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
close icon

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

26 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). 





GK Gowthamraj Kumar Syncfusion Team 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


GK Gowthamraj Kumar Syncfusion Team 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


GK Gowthamraj Kumar Syncfusion Team 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


PV Prakash Viswanathan Syncfusion Team 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




PV Prakash Viswanathan Syncfusion Team 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


PV Prakash Viswanathan Syncfusion Team 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'.




GK Gowthamraj Kumar Syncfusion Team May 6, 2021 12:21 PM UTC

Hi Gordon,

 
Thank you for your update.   
 
Regards, 
Gowthamraj K 



JP jay patadia August 6, 2021 12:12 PM UTC

I have Azure Function 2.0 runtime dot net core 3.1. I facing the Html conversion error. I have also unchecked the run from the package file option. When I ran in the local machine it works fine. 


Does anyone have any other suggestions for this issue?  


I followed this article https://www.syncfusion.com/kb/10301/how-to-convert-html-to-pdf-in-azure-functions-2-0


Thank you,

Sagar Thakkar



GK Gowthamraj Kumar Syncfusion Team August 9, 2021 12:43 PM UTC

Hi Sagar/Jay, 
 
Thank you for contacting Syncfusion support.

 
We already faced the similar issue in Azure functions 3.1. The reported issue may occurs due to QtBinaries assemblies are not copied properly with Azure SDK 3.0.11. Please follow the below steps to copy the files properly to resolve the reported issue.   
  1. Open the Azure portal in browser.
  2. Navigate to the deployed Azure function in Azure portal.
  3. Open the console of Azure function.
   
  
  1. As we said earlier, QtBinaries assemblies are not copied properly while publish to Azure functions.
  2. So, we need to manually copy all the assemblies from azure portal.
  3. QtBinariesWindows from location “c:\home\site\wwwroot\QtBinariesWindows” does not have all the assemblies, so we need to copy all the assemblies and inner folder from bin folder.
  1. Using cd command, navigate to the location “c:\home\site\wwwroot\bin\QtBinariesWindows” and run the below command.
cp *.* c:\home\site\wwwroot\QtBinariesWindows\  
  
   
  
  1. Then we need to copy the files from “platform” and “imageformats” folders using the same approach.
  1. Using cd command, navigate to the location “c:\home\site\wwwroot\bin\QtBinariesWindows\platforms” and run the below command.
cp *.* c:\home\site\wwwroot\QtBinariesWindows\platforms  
  
  1. Using cd command, navigate to the location “c:\home\site\wwwroot\bin\QtBinariesWindows\imageformats” and run the below command.
cp *.* c:\home\site\wwwroot\QtBinariesWindows\imageformats  
  
  1. Ensure the all the files are copied to “c:\home\site\wwwroot\QtBinariesWindows” location using dir command. Also, ensure the inner folders (imageformats, platforms) has all the files.
   
  1. Now try the conversion from Azure function URL.
  2. We need to copy this assemblies for the first time only.
Regards, 
Gowthamraj K 



SR Srinivas Raghav December 2, 2023 08:42 PM UTC

Hi All,


We are getting this below error when one of our function in our application uses : htmltopdf converter


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)

We are getting this error only in production IIS server , initially this issue came in stage server then we had resolved this issue by giving full permissions to IIS USR AND IUSR (full control)

When similar is tried in prod , this issue is happening , could you kindly help



SN Santhiya Narayanan Syncfusion Team December 4, 2023 01:22 PM UTC

Currently we are checking the reported issue on our end and will update the further details on december 6th,2023



SN Santhiya Narayanan Syncfusion Team December 5, 2023 02:08 PM UTC

You need to provide full access permissions to IIS_IUSRS on the production server. If you are unable to provide these permissions in the production server environment, you can set the tempPath and blink path and then provide read/write/execute permissions to that folder for the respective group.

Please find the below UG link
https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#troubleshooting
https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#temporary-path
https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#webkitpath

Please ensure that the assemblies (MSVCP100.dll, MSVCR100.dll) are available on the production server.

Please refer the below UG link
https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#vc-redistributable




SR Srinivas Raghav December 7, 2023 05:18 PM UTC

to which folders I need to provide full access  : for   IIS_IUSRS ?




KS Karmegam Seerangan Syncfusion Team December 8, 2023 09:22 AM UTC

Hi Srinivas,


Kindly provide full permissions to the webkit TempPath folder and Qtbinaries folder in your production server for the IIS_IUSRS user group. Please refer to the screenshot for your reference.




As we said earlier, Kindly check the VC redistributable files (MSVCP100.dll, MSVCR100.dll) and Qtbinaries are properly copied into the Production server. Please refer to the previously shared troubleshooting section documentation link to resolve this issue.


Regards,

Karmegam



SR Srinivas Raghav December 9, 2023 10:07 AM UTC

After completing the above setup in IIS , when our application runs for first time when this is syncfusion is used in any new transaction getting same error , but however within same sessions the following transaction we are not facing this issueIs there any reason behind this? it doesnt look like cache issue also , since even we tried to clear cache and run the method against the transaction which failed in first instance - we are getting same error repeatedly , however if we move to next transaction data and execute the method which uses syncfusion from there on no issuesi.e. if one data is success , anything following that is not having issues , but first time when executed data only having issue



SR Srinivas Raghav December 9, 2023 08:55 PM UTC

I have also tried all the above possibilities suggested above in prod server but issue is not resolved , I have given entire c and d drives for permission of IIS IUSR but not resolved


I have checked for DLL mentioned also in prod server , everything is same.



KS Karmegam Seerangan Syncfusion Team December 11, 2023 11:38 AM UTC

Hi Srinivas,


We have created a new ticket under your account to follow up with this query. We suggest you to follow up with the ticket for further updates. Please login using the below link.

https://support.syncfusion.com/agent/tickets/530672


Regards,

Karmegam



SV Srinivas V December 11, 2023 12:11 PM UTC

Pic.jpg I dont have access to the above link



KS Karmegam Seerangan Syncfusion Team December 11, 2023 01:08 PM UTC

Sorry for the inconvenience.

Kindly ignore the previously provided link, please try login using this link: https://support.syncfusion.com/support


Loader.
Live Chat Icon For mobile
Up arrow icon