)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Failed to convert the webpage exception with WebKit HTML converter

Platform: WinForms |
Control: PDF |
Published Date: November 30, 2017 |
Last Revised Date: April 29, 2019

The following are some cases, where the WebKit HTML converter may throw Failed to convert webpage exception and the solution to overcome the exception is given.

Reason

Solution

This exception may occur when converting HTML string with URL to PDF conversion method. 

Make sure to use HTML string to PDF conversion with proper overload methods. Refer to the following links for converting URL to PDF and HTML string to PDF.

 

URL to PDF: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#url-to-pdf

HTML string to PDF: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#html-string-to-pdf

 

If you are using HTML string in URL to PDF method, then this exception occurs.

 

//URL to PDF conversion, correct overload
PdfDocument document = htmlConverter.Convert("http://www.google.com");  // This is correct
 
//HTML string to PDF, incorrect overload
PdfDocument document = htmlConverter.Convert(“<html>Hello World</html>”);  
 
//HTML string to PDF, correct overload with base URL. 
PdfDocument document = htmlConverter.Convert(“<html>Hello World</html>”, “”);  //This is correct

 

If the Syncfusion.HtmlConverter.Base.dll assembly is blocked in the machine, then the converter may throw this exception.

Unblock the assembly if it is blocked by referring to the following screenshot of Syncfusion.HtmlConverter.Base.dll,

 

 Assembly unblocking screenshot

This exception may occur if the assemblies and QtBinaries are used from different version of WebKit installers.

Make sure to use the Syncfusion assemblies and QtBinaries from the same WebKit Installer since there will be some changes in the assemblies and QtBinaries for every release. The assemblies and QtBinaries for a specific version can be get by installing the WebKit HTML converter.

WebKit HTML converter: https://www.syncfusion.com/downloads/version-history    

 

While converting HTML to PDF, WebKit HTML converter internally creates temporary files in temp folder for conversion.

 

If the temporary folder does not have elevated permission for the respective user, then the WebKit HTML converter may throw this exception.

By default, WebKit HTML converter gets system temporary folder to create temporary files for conversion. Refer to the following examples of default temporary folder.

 

  • C:\Users\<<username>>\AppData\Local\Temp
  • C:\Windows\Temp

 

Make sure that the previous paths have elevated permission for respective user.

 

(Or)

 

The WebKit HTML converter has support for setting temporary path. Using the TempPath property, you can set any folder path that has read/write/execute permission. Then, the converter uses this path for creating temporary files. Refer to the following code snippet to set temp folder.  

 

WebKitConverterSettings settings = new WebKitConverterSettings();
settings.TempPath = "D://MyProject//bin";

 

If the user has elevated permission, but still getting the failed to convert webpage exception.

 

Please try hosting an application using different user account of the server and check the conversion.

WebKit HTML converter may throw this exception if the Web Application is published in a network shared location.

 

To avoid this exception, publish the application in the server’s local disk, where it will be hosted. Please do not publish the website to shared network location.

If the temporary executables are blocked due to group policy/third party softwares in server.

The temporary executables can be whitelisted in the server using the following ways:

 

  • Set the path of a folder in server as the temporary executables path by setting the TempPath property of WebkitConverterSettings and add that folder’s path in the exception list of group policy/Third Party Software.

 

//Set temporary path to generate temporary files
webkitConverterSettings.TempPath@"C:/HtmlConversion/Temp/";

 

 

 

  • Set a name for the executable in the server by setting the TempFileName property of WebkitConverterSetings and add that name in the exception list of group policy/Third Party Software.

 

//Set temporary file name to generate temporary files 
webkitConverterSettings.TempFileName = "Syncfusion";

 

 

The temporary path may do not have the required (read/write/execute) permission.

 

Enable the read/write/execute permission of the temporary path for the respective group.   

If the failed to convert webpage exception occurs only for particular URL.

 

Please contact Syncfusion support with input HTML, code snippet, and environment details (OS, culture settings, bit version, and more).

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
rayman
Jan 26, 2019

how to go about solving this issue if application is hosted on azure ?

Reply
Karthikeyan Chandrasekar [Syncfusion]
Jan 28, 2019

Hi Rayman,

 

Cause

Solution

Failed to convert web page exception

 

 

Before deploying the application, ensure the conversion in local machine. Please refer below KB for more information about HTML to PDF conversion in Azure.

 

KB: https://www.syncfusion.com/kb/7543/  

Failed to convert web page exception in Azure.

 

Please make sure you are using the hosting plans from B1 or above. As our HTML to PDF conversion will works from basic hosting plan (B1). So, select the hosting plan based on the need. HTML to PDF conversion will not work if the hosting plan is Free/Shared.

Unblock the assembly if it is Syncfusion.HtmlConverter.Base.dll,

 

When deploying the application to Azure, the assemblies will not getting blocked. So, please ensure the assembly is unblocked in your local machine before deploying to Azure app service.

This exception may occur if the assemblies and QtBinaries are used from different version of WebKit installers.

You can ensure the Assemblies and QtBinaries are used from the same version of HTML converter in your local machine, before deploying into Azure.

While converting HTML to PDF, WebKit HTML converter internally creates temporary files in temp folder for conversion.

 

  1. If the temporary folder does not have elevated permission for the respective user then the WebKit HTML converter may throw this exception.

 

  1. If the temporary executables are blocked due to group policy/third party softwares in server.

 

  1. The temporary path may do not have the required (read/write/execute) permission.

Please set the bin folder or QtBinaries folder path as temporary path in WebKit converter settings. We already ensured the conversion with default and the above mentioned paths in Azure with WebKit HTML converter.

 

Please refer below UG links for more information.

UG: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#temporary-path

Trouble shooting: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#troubleshooting

 

Regards,

Karthikeyan 

Anil Kumar
Apr 08, 2020

Hi, how to download and view the file in the browser instead of saving to the folder in ASP.NET application

Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon