From 4f377f543141cb438d2e6ed971ca4090f1d359b4 Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Tue, 20 Feb 2024 11:21:41 +0530 Subject: [PATCH 1/2] 870904: Need to add the Time out support in UG documentation. --- .../PDF/Convert-HTML-To-PDF/features.md | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/features.md b/File-Formats/PDF/Convert-HTML-To-PDF/features.md index 165e2f3d1..16d99e3e2 100644 --- a/File-Formats/PDF/Convert-HTML-To-PDF/features.md +++ b/File-Formats/PDF/Convert-HTML-To-PDF/features.md @@ -2132,4 +2132,59 @@ Refer to the following code snippet to resize the page content size. {% endtabs %} -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). \ No newline at end of file +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). + + +## Timeout + +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. + +Refer to the following code snippet to set the timeout for HTML to PDF conversion. + +{% tabs %} + +{% highlight c# tabtitle="C# [Cross-platform]" %} + + //Initialize the HTML to PDF converter. + HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); + //Initialize the blink converter settings. + BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); + // Set the conversion timeout to 5000 milliseconds + blinkConverterSettings.ConversionTimeout = 5000; + //Assign Blink converter settings to HTML converter + htmlConverter.ConverterSettings = blinkConverterSettings; + //Convert URL to PDF + PdfDocument document = htmlConverter.Convert("https://www.google.com"); + //Create a file stream. + FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); + //Save and close the PDF document. + document.Save(fileStream); + //Close the document. + document.Close(true); + +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} + + 'Initialize the HTML to PDF converter. + Dim htmlConverter As New HtmlToPdfConverter() + 'Initialize the blink converter settings. + Dim blinkConverterSettings As New BlinkConverterSettings() + 'Set the conversion timeout to 5000 milliseconds + blinkConverterSettings.ConversionTimeout = 5000 + 'Assign Blink converter settings to HTML converter + htmlConverter.ConverterSettings = blinkConverterSettings + 'Convert URL to PDF + Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com") + 'Create a file stream. + Dim fileStream As New FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite) + 'Save and close the PDF document. + document.Save(fileStream) + 'Close the document. + document.Close(True) + +{% endhighlight %} + +{% endtabs %} + +You can download a complete working sample from [GitHub](). \ No newline at end of file From 2fa3d22572b538fa6cc10dcac7eafa1a69cdbbd1 Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Wed, 21 Feb 2024 10:38:36 +0530 Subject: [PATCH 2/2] 870904: Added the github sample link. --- File-Formats/PDF/Convert-HTML-To-PDF/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/features.md b/File-Formats/PDF/Convert-HTML-To-PDF/features.md index 16d99e3e2..5940d6340 100644 --- a/File-Formats/PDF/Convert-HTML-To-PDF/features.md +++ b/File-Formats/PDF/Convert-HTML-To-PDF/features.md @@ -2187,4 +2187,4 @@ Refer to the following code snippet to set the timeout for HTML to PDF conversio {% endtabs %} -You can download a complete working sample from [GitHub](). \ No newline at end of file +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). \ No newline at end of file