From 114422b5cffa917003b91f07dc2025105c814e14 Mon Sep 17 00:00:00 2001 From: GowthamrajKumar25 <93317718+GowthamrajKumar25@users.noreply.github.com> Date: Fri, 20 Jun 2025 17:49:46 +0530 Subject: [PATCH 1/3] Removed the security causing namespaces in code snippet. --- .../Program.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs index 001cbd28..33da77c2 100644 --- a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs +++ b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs @@ -2,19 +2,17 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Create blink converter settings BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); -if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) -{ - //Set command line arguments to run without the sandbox. - blinkConverterSettings.CommandLineArguments.Add("--no-sandbox"); - blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); - blinkConverterSettings.AdditionalDelay = 0; -} + +//Set command line arguments to run without the sandbox +blinkConverterSettings.CommandLineArguments.Add("--no-sandbox"); +blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); +blinkConverterSettings.AdditionalDelay = 0; + //Assign Blink converter settings to HTML converter. htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF document. @@ -26,4 +24,4 @@ document.Save(fileStream); } //Close the document. -document.Close(true); \ No newline at end of file +document.Close(true); From 99d74062ce52f08ae0e2cdaacbd3bdaf8b1d8a3b Mon Sep 17 00:00:00 2001 From: GowthamrajKumar25 <93317718+GowthamrajKumar25@users.noreply.github.com> Date: Fri, 20 Jun 2025 20:36:27 +0530 Subject: [PATCH 2/3] Revert the command line changes for linux platforms --- .../.NET/Convert-website-URL-to-PDF-document/Program.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs index 33da77c2..cc1e0f64 100644 --- a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs +++ b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs @@ -8,11 +8,6 @@ //Create blink converter settings BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); -//Set command line arguments to run without the sandbox -blinkConverterSettings.CommandLineArguments.Add("--no-sandbox"); -blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); -blinkConverterSettings.AdditionalDelay = 0; - //Assign Blink converter settings to HTML converter. htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF document. From 29c0b751f834ba4e00da63531810df7225c46b91 Mon Sep 17 00:00:00 2001 From: GowthamrajKumar25 <93317718+GowthamrajKumar25@users.noreply.github.com> Date: Fri, 20 Jun 2025 20:37:03 +0530 Subject: [PATCH 3/3] Revert the command line changes for linux platforms in README.md --- .../.NET/Convert-website-URL-to-PDF-document/README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md index 59e5a519..0644d8c1 100644 --- a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md +++ b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md @@ -15,7 +15,6 @@ Step 3: **Include necessary namespaces**: Add the following namespaces in your ` ```csharp using Syncfusion.HtmlConverter; using Syncfusion.Pdf; - using System.Runtime.InteropServices; ``` Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to convert a website URL to a PDF file: @@ -25,12 +24,6 @@ Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Create blink converter settings BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - //Set command line arguments to run without the sandbox. - blinkConverterSettings.CommandLineArguments.Add("--no-sandbox"); - blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); - } //Assign Blink converter settings to HTML converter. htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF document. @@ -47,4 +40,4 @@ Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Convert-website-URL-to-PDF-document). -More information about the HTML to PDF conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features) section. \ No newline at end of file +More information about the HTML to PDF conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features) section.