HTML to PDF check HTTP response

Hello,
Is it possible to check the http status code of an html to pdf request?

Here is a sample code:

HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink);
...
PdfDocument document = htmlConverter.Convert("url");

When the web page returns an error like a bad request, the converter creates a blank page with header and footer (if setted),
is it possible to get in some way this error?

If is not possible to get the http error can I check if in the document there is only one empty page?

Thank you.

3 Replies

SL Sowmiya Loganathan Syncfusion Team June 1, 2020 12:43 PM UTC

Hi Fabrizio,   
  
Thank you for contacting Syncfusion support.    
  
No. Currently, it is not possible to get the HTTP error from a bad request document in our Html Converter. This blank page pdf occurs due to provided web pages is incorrect or wrong URL, so please entered the address manually into the browser and make sure the provided web pages is works properly.   
  
Please refer the below links for more information,   
  
Please let us know if you need any further assistance with this. 

Regards, 
Sowmiya Loganathan    



FA Fabrizio Alessandro June 1, 2020 01:08 PM UTC

Thank you for your reply, there is a way to check if the PdfDocument has only a blank page? 

Thank you


SL Sowmiya Loganathan Syncfusion Team June 2, 2020 03:26 PM UTC

Hi Fabrizio, 

Thank you for your update. 

Yes. We can check the empty page by extracting the text from the pdf page. We have created a simple sample for checking the empty page from existing document in our library. We have attached the sample for your reference. Please try the below sample in your end and let us know if it is suites your requirement. 


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

Regards, 
Sowmiya Loganathan 


Loader.
Up arrow icon