Html-to-PDF converter not waiting till Blazor page is loaded before rendering

Apologies if this has been asked previously, but I am wondering if there is a way for the HTML-to-PDF converter tool to wait until a Blazor page has loaded?  

We are using this tool to export a page to PDF, but occasionally the page takes a while to load (depends on how much data is being loaded). I can set an 'AdditionalDelay' in the Blink Converter settings, but this doesn't work all the time, and it feels like bad coding to arbitrarily set a time and hope it works.

Is there a way to make the converter wait till the page is loaded before rendering as PDF? 


3 Replies

AM Arumugam Muppidathi Syncfusion Team June 24, 2025 12:02 PM UTC

Hi Darryn,

Thank you for getting back to us.

We have checked the reported issue on our end.  Upon further analysis, if the time required to load the resources is unpredictable, we recommend using the WindowsStatus property in BlinkConverterSettings.  You can modify your HTML file to ensure it meets the value required for the WindowsStatus property. 

Please refer the code snippet below

// Initialize the HTML to PDF converter.

HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();

BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();

//Set windows status

blinkConverterSettings.WindowStatus = "completed";

//Assign Blink converter settings to HTML converter

htmlConverter.ConverterSettings = blinkConverterSettings;

//Convert URL to PDF

PdfDocument document = htmlConverter.Convert("input.html");

FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);

//Save and close the PDF document.

document.Save(fileStream);

document.Close(true);


However, we have attached our documentation and sample below for your reference


Documentation: Converting HTML to PDF | Syncfusion

Sample: PDF-Examples/HTML to PDF/Blink/Set-windows-status-while-converting-HTML-to-PDF at master · SyncfusionExamples/PDF-Examples · GitHub


Please try the above sample and let us know the result.  If you are still facing any issue, we kindly request you to share the modified sample, input HTML document, code snippet, Syncfusion package name and version, .NET version to reproduce the issue on our end and provide you with a prompt solution.

Regards,
Arumugam M



DF Darryn Flood June 27, 2025 05:54 AM UTC

Thanks for the reply  Arumugam.

I have tried to implement your solution, and it worked for a while, but now it is crashing big time. When I tried to run the converter, it starts a 'Chrome.exe' instance (which I believe is needed to render the PDF), and starts to consume all the memory and CPU.

When I remove the ' blinkConverterSettings.WindowStatus = "completed"; ' setting, and go back to the AdditionalDelay property, it works fine.

I think this may be an issue in the latest versions of the Syncfusion libraries. I had it working in a previous version (29.2.4), but once I upgraded (29.2.11 and 30.x), it caused all sorts of issues.

Hopefully you can help.



AM Arumugam Muppidathi Syncfusion Team June 30, 2025 11:45 AM UTC

Hi Darryn,



Thank you for getting back to us.

 

We have investigated the reported issue on our end. Upon further analysis, we were unable to reproduce the issue—HTML to PDF conversion is functioning correctly with the WindowsStatus property in Blazor applications when using the latest version of our packages.

 

We suspect that the issue may be related to the specific input HTML document you are using. To help us analyze this further and provide a prompt resolution, we kindly request you to share the input HTML document and a sample project that reproduces the issue.

 

For your reference, we have attached the sample along with the corresponding output PDF document.

 

We encourage you to try the provided sample on your end and let us know the results. If the issue persists, please share the requested details so we can continue our investigation and assist you further.

 

We look forward to your response.


Regards,

Arumugam M


Attachment: HTMLtoPDFBlazorWindowsStatus_cc90d16.zip

Loader.
Up arrow icon