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:'CreateProcessAsUser error #193'

Hello,
im having problem.
i got error message to Covert URL to PDF

here my code
//Initialize the HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = @"/QtBinaries/";
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);

Thank you.

6 Replies

GK Gowthamraj Kumar Syncfusion Team November 11, 2019 12:23 PM UTC

Hi Muhammad, 

Thank you for contacting Syncfusion support.   
  
The reported exception might occur due to the following causes, please try the below trouble shooting steps and try the conversion. 

  1. Our HTML converter internally creates and launches a surrogate process from a temporary folder. So, the converter required read/write and execute permission of the temporary folder. So, please check the temporary folder has read/write/execute permission for the respective user group.
 
  1. If we do not explicitly set TempPath in WebKitConverterSettings then the converter will make use of system temporary folder for creating temporary files. So, please make sure the provided temporary folder has the required permission.
 
  1. This exception may occurs if the machine blocks (prevents the execution of the process) the temporary surrogate process. If you are using any software/program to block the unknown executables, you can whitelist the temporary surrogate process using two ways.
  • You can allow the executables from the particular folder and set the path of the folder as TempPath in WebKitConverterSettings.
  • You can allow the executable with name, you can settings any name to process using TempFileName property. (If we set this property, the temporary process will be created with this name)
 
  1. Make sure that you are using Syncfusion assemblies and QtBinaries from same version of HTML converter installer or NuGet package.
 
  1. Check the Syncfusion.HtmlConverter.Base.dll is blocked or not, if it is blocked please try the conversion after unblock it. Please refer below link for more information.
 
Also, please make sure the mentioned prerequisites are available in the machine where the conversion take place.   

We have attached a simple sample, which is working fine in our end. Please try the sample in your machine and let us know the result. 

Kindly try the above suggestions and if still the same exception occurs, kindly provide more details such as product version and environment details (OS, bit version, culture settings, RAM size etc.,) to check the conversion in our end. So, that it will be helpful for us to analyze and assist you further on this.  

Regards, 
Gowthamraj K 



AH Amir H August 28, 2020 08:34 AM UTC

Hi,

I have tried everything you mentioned for converting an HTML string to PDF on macOS Catalina but no matter what temp folder I specify or I don't specify or use chown/chmod I keep on getting this error:


Syncfusion.Pdf.PdfException: Permission denied
   at Syncfusion.HtmlConverter.HtmlConverter.ConvertHtmlToPdf(String url, Int32 width, Int32 height, String tempFile)
   at Syncfusion.HtmlConverter.HtmlToPdfConverter.Convert(String url)
   at Syncfusion.HtmlConverter.HtmlToPdfConverter.Convert(String html, String baseurl)
   at SwiftCare.Controllers.ReportsController.ConvertToPdfByteArray_UsingSyncfusion(String html) in /Users/amir/Projects/SwiftCare/SwiftCare/Controllers/ReportsController.cs:line 309
   at SwiftCare.Controllers.ReportsController.ConvertToPdfUsingSelector(String html) in /Users/amir/Projects/SwiftCare/SwiftCare/Controllers/ReportsController.cs:line 265
   at SwiftCare.Controllers.ReportsController.RunReport(String formName, String viewName, IEnumerable`1 reportParameters) in /Users/amir/Projects/SwiftCare/SwiftCare/Controllers/ReportsController.cs:line 141


GK Gowthamraj Kumar Syncfusion Team August 31, 2020 09:13 AM UTC

Hi Amir,   
  
Thank you for your update.   
  
As we mentioned earlier, this exception may occurs due to the machine blocks (prevents the execution of the process) the temporary surrogate process. If you are using any software/program to block the unknown executables, you can whitelist the temporary surrogate process using two ways.   
You can allow the executables from the particular folder and set the path of the folder as TempPath in WebKitConverterSettings.   
You can allow the executable with name, you can settings any name to process using the TempFileName property. (If we set this property, the temporary process will be created with this name)   
  
You can specify the particular folder as a temporary folder using the TempPath property of WebKitConverterSettings. Please ensure that the specified folder has read/write/execute permission. Refer below the UG link for more information. 
   
Please refer below link for prerequisites and troubleshooting steps,     

However, please check the Syncfusion.HtmlConverter.Portable.dll is blocked or not, if it is blocked please try the conversion after unblock it. Please refer below link for more information. 

Kindly try the above suggestions and if still the same exception occurs, kindly provide more details such as product version and Mac configuration details (OS, bit version, etc) to check the conversion in our end. So, that it will be helpful for us to analyze and assist you further on this.    

Regards, 
Gowthamraj K 



AH Amir H September 3, 2020 05:00 AM UTC

Hi,

I am not using any program or anti virus blocking the dll or access to the folder. 

I ran the test on a fresh install of MacOS Catalina and I am always getting permission denied error.

Please advise. 


GK Gowthamraj Kumar Syncfusion Team September 4, 2020 03:02 PM UTC

Hi Amir, 

Thank you for your update. 

Currently we are setting up the same environment to reproduce the issue in our end and we will update the further details on September 9th 2020. 

Regards, 
Gowthamraj K 



GK Gowthamraj Kumar Syncfusion Team September 9, 2020 03:32 PM UTC

Hi Amir,  
 
Thank you for your update. 
  
We have tried to reproduce the reported issue with same environment (MacOS Catalina 10.15.4), but it is working properly. WebKit HTML converter internally creates and launches surrogate process in temporary folder for converting the HTML to PDF. By default the HTML converter takes system temporary folder for generating the temporary files. We have created a sample and perform HTML to PDF conversion, it generates a PDF document properly without any exception. We were unable to reproduce the exception in our end and we have shared the sample for your reference. Kindly please try to run the sample in your end and let us know the result.   
 
 
Note: You can specify the particular folder as a temporary folder using the TempPath property of WebKitConverterSettings. Please ensure that the specified folder has read/write/execute permission. Please let us know whether you are using HtmlConverter Mac build or NuGet packages for converison. 
 
If still you are facing the same issue, kindly provide more details such as complete input HTML file/URL (with all resources styles, scripts, etc.,), modified sample, product version to reproduce the issue in our end. So, that it will be helpful for us to analyze and assist you further on this.   
 
Regards, 
Gowthamraj K 


Loader.
Up arrow icon