Convert HTML to PDF using Blink - exceptions are not caught

If any error occurs when converting a URL to PDF using Blink, Syncfusion throws a PdfException on the thread pool which is impossible to catch in the scope of the method initiating the conversion. The call stack looks like this:

Syncfusion.Pdf.PdfException: Failed to convert webpage at Syncfusion.HtmlConverter.BlinkConverter.ConvertToPdf(String url, PdfDocument& document) at Syncfusion.HtmlConverter.BlinkConverter.<>cDisplayClass161_0.b0() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart().

To reproduce you can specify an invalid WindowStatus condition. 

Sample project: http://s000.tinyupload.com/index.php?file_id=30695898869487944940


12 Replies

SL Sowmiya Loganathan Syncfusion Team May 15, 2020 07:49 AM UTC

Hi Feliks,   
  
Thank you for contacting Syncfusion support.    
  
We have checked the conversion with the provided sample and the reported exception is reproduced. If the conversion is getting failed, then the converter throws the failed to convert web page exception. The exception occurs in the provided sample is due to the WindowStatus property. This property should be set, when the input HTML/URL contains window.status in the script, otherwise, it will cause a hanging issue or it will throw the failed to convert web page exception. But the input URL/HTML does not have a window.status but the WindowStatus is set to the converter settings.    
  
So, it will not generate a PDF document in the Blink rendering engine itself, so we could not process the empty stream or empty PDF document, so the converter is thrown custom failed to convert web page exception.   
  
Please let us know if you need any further assistance with this.    
 
Regards, 
Sowmiya Loganathan 



FM Feliks Mushynskyi May 15, 2020 12:24 PM UTC

The fact that it throws an exception is not an issue here. The issue is that the exception cannot be caught by wrapping Convert() call in a try-catch block. It should be throwing exceptions of the calling thread instead of doing it on the thread pool.


SL Sowmiya Loganathan Syncfusion Team May 18, 2020 12:18 PM UTC

Hi Feliks,   
  
Thank you for providing details.   
  
We were able to reproduce the issue “Exception not caught with HTML converter” and we suspect this to be a defect. Currently, we are validation on this and we will update the further details on May 20th, 2020.   
 
Regards, 
Sowmiya Loganathan 



GK Gowthamraj Kumar Syncfusion Team May 20, 2020 03:21 PM UTC

Hi Feliks, 

Thank you for your patience. 

We have confirmed that the issue with “Exception not caught with HTML converter using Blink” is a defect. The fix for this issue is estimated to be available on May 27th,  2020.    
 
Please find the feedback link for this from below,      

Note: Can you please share us the product version which you need the patch, so that we will update the patch in the same version. 

Regards, 
Gowthamraj K 



FM Feliks Mushynskyi May 20, 2020 03:29 PM UTC

Please patch the latest (18.1) version of Syncfusion.HtmlToPdfConverter.Blink.Net.Core.Windows and Syncfusion.HtmlToPdfConverter.Blink.Net.Core.Linux packages.


SL Sowmiya Loganathan Syncfusion Team May 21, 2020 07:46 AM UTC

Hi Feliks,  
 
Thank you for the update.  
 
As promised earlier, we will provide the patch in v18.1.0.52 on May 27th, 2020.  
 
Please let us know if you have any concerns on this.  
 
Regards, 
Sowmiya Loganathan 




SL Sowmiya Loganathan Syncfusion Team May 27, 2020 11:06 AM UTC

Hi Feliks,  
 
We have fixed the issue with “Exception not caught with Blink rendering engine” and the fix for this issue can be downloaded from below link,  
 
Assembly version: 18.1.0.52 
 
Installation directions: 
  1. The above patch has Syncfusion.HtmlToPdfConverter.Blink.Net.Core.Windows and Syncfusion.HtmlToPdfConverter.Blink.Net.Core.Linux packages without BlinkBinaries.
  2. You can get the BlinkBinaries folders from your old packages.
  3. Download the above packages and install the packages to your project.
 
Please find the feedback link below to tract the status of the issue, 
 
Please let us know if you have any concerns on this.  
 
Regards, 
Sowmiya Loganathan 
 
 
 



FM Feliks Mushynskyi May 27, 2020 12:43 PM UTC

Thanks Sowmiya. The fix looks good. When can we expect it to be available on nuget.org?


PV Prakash Viswanathan Syncfusion Team May 28, 2020 12:27 PM UTC

Hi Feliks,  

Thank you for the update.   

The fix will be included in our upcoming Volume 2 2020 release, which will be available by mid of June 2020. We will let you know once the Volume 2 release is rolled out in this forum.   

Regards,  
Prakash V 



FM Feliks Mushynskyi June 17, 2020 05:57 PM UTC

Hi Prakash. Are you guys still targeting mid June for Vol 2?


SL Sowmiya Loganathan Syncfusion Team June 18, 2020 10:34 AM UTC

Hi Feliks,   
 
The Volume 2 release is estimated to available on June 29, 2020 and will let you know once it is released.   
 
Regards,  
Sowmiya Loganathan  
 



SL Sowmiya Loganathan Syncfusion Team July 8, 2020 05:24 AM UTC

  
Hi Feliks,  
 
We have included the fix for the reported issue in our 2020 Volume 2 Main Release v18.2.0.44. Please find the feedback link from below, 
 
We are glad to announce that our Essential Studio Volume 2, 2020 release (v18.2.0.44) is rolled out and is available for download under the following link. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Sowmiya Loganathan 
 


Loader.
Up arrow icon