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 3c30cc0d..857781b6 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 @@ -6,6 +6,16 @@ //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"); +} +//Assign Blink converter settings to HTML converter. +htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); //Create file stream. @@ -15,4 +25,4 @@ document.Save(fileStream); } //Close the document. -document.Close(true); \ No newline at end of file +document.Close(true);