Click or drag to resize
Pdf Library for .NET
Conversion Delay and Web Page Timeout with Html to Pdf Converter for .NET

For pages that use javascripts heavily, the conversion can be delayed a number of seconds using MinPageLoadTime property of the HtmlToPdfOptions object, to allow the content to be fully rendered.

In a similar way, if a page takes too much time to load, the converter can specify the amount of time in seconds when the page load will timeout using the property MaxPageLoadTime property of the HtmlToPdfOptions object.

Sample Code

This sample code shows how the html to pdf converter can be used to convert a web page to pdf using Select.Pdf Pdf Library for .NET and how to set the conversion delay and timeout properties.

// instantiate a html to pdf converter object
HtmlToPdf converter = new HtmlToPdf();

// specify the number of seconds the conversion is delayed
converter.Options.MinPageLoadTime = 2;

// set the page timeout (in seconds)
converter.Options.MaxPageLoadTime = 30;

// create a new pdf document converting an url
PdfDocument doc = converter.ConvertUrl(TxtUrl.Text);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
See Also