Skip to content

Commit 792b61a

Browse files
Merge pull request #1883 from Syncfusion-Content/hotfix/hotfix-v24.2.3
DOCINFRA-2341_merged_using_automation
2 parents b28ef6d + e031ff3 commit 792b61a

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

File-Formats/PDF/Convert-HTML-To-PDF/features.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2132,4 +2132,59 @@ Refer to the following code snippet to resize the page content size.
21322132

21332133
{% endtabs %}
21342134

2135-
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/HTML-to-PDF-scale-property).
2135+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/HTML-to-PDF-scale-property).
2136+
2137+
2138+
## Timeout
2139+
2140+
HTML content being converted takes a long time to render or convert into a PDF can be achieved through the utilization of the Timeout property of Blink in HTML Converter.
2141+
2142+
Refer to the following code snippet to set the timeout for HTML to PDF conversion.
2143+
2144+
{% tabs %}
2145+
2146+
{% highlight c# tabtitle="C# [Cross-platform]" %}
2147+
2148+
//Initialize the HTML to PDF converter.
2149+
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
2150+
//Initialize the blink converter settings.
2151+
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
2152+
// Set the conversion timeout to 5000 milliseconds
2153+
blinkConverterSettings.ConversionTimeout = 5000;
2154+
//Assign Blink converter settings to HTML converter
2155+
htmlConverter.ConverterSettings = blinkConverterSettings;
2156+
//Convert URL to PDF
2157+
PdfDocument document = htmlConverter.Convert("https://www.google.com");
2158+
//Create a file stream.
2159+
FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);
2160+
//Save and close the PDF document.
2161+
document.Save(fileStream);
2162+
//Close the document.
2163+
document.Close(true);
2164+
2165+
{% endhighlight %}
2166+
2167+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
2168+
2169+
'Initialize the HTML to PDF converter.
2170+
Dim htmlConverter As New HtmlToPdfConverter()
2171+
'Initialize the blink converter settings.
2172+
Dim blinkConverterSettings As New BlinkConverterSettings()
2173+
'Set the conversion timeout to 5000 milliseconds
2174+
blinkConverterSettings.ConversionTimeout = 5000
2175+
'Assign Blink converter settings to HTML converter
2176+
htmlConverter.ConverterSettings = blinkConverterSettings
2177+
'Convert URL to PDF
2178+
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
2179+
'Create a file stream.
2180+
Dim fileStream As New FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite)
2181+
'Save and close the PDF document.
2182+
document.Save(fileStream)
2183+
'Close the document.
2184+
document.Close(True)
2185+
2186+
{% endhighlight %}
2187+
2188+
{% endtabs %}
2189+
2190+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Time-out-support-in-HTML-to-PDF/.NET).

0 commit comments

Comments
 (0)