diff --git a/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/Program.cs b/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/Program.cs index 0ace91a9..44a0c4bc 100644 --- a/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/Program.cs +++ b/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/Program.cs @@ -44,4 +44,6 @@ //Close the document. loadedDocument.Close(true); + certificateStream.Dispose(); + imageStream.Dispose(); } \ No newline at end of file diff --git a/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md b/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md index 2e41ea91..2a49babd 100644 --- a/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md +++ b/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md @@ -61,6 +61,8 @@ Step 4: **Add digital signature code**: Use the following code snippet in `Progr // Close the document loadedDocument.Close(true); + certificateStream.Dispose(); + imageStream.Dispose(); } ``` 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 2c6df233..59e5a519 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 @@ -21,18 +21,28 @@ Step 3: **Include necessary namespaces**: Add the following namespaces in your ` Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to convert a website URL to a PDF file: ```csharp - // Initialize the HTML to PDF converter - HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); - - // Convert a URL to a PDF document - PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); - - // Create the FileStream to save the PDF document - FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); - - // Save and close the PDF document - document.Save(fileStream); - document.Close(true); + //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. + using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) + { + //Save the PDF document + document.Save(fileStream); + } + //Close the document. + document.Close(true); ``` 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).