diff --git a/HTML to PDF/Blink/Access-a-webpage-using-HTTP-GET/.NET/Access-a-webpage-using-HTTP-GET/Program.cs b/HTML to PDF/Blink/Access-a-webpage-using-HTTP-GET/.NET/Access-a-webpage-using-HTTP-GET/Program.cs index c5594188..74026d5e 100644 --- a/HTML to PDF/Blink/Access-a-webpage-using-HTTP-GET/.NET/Access-a-webpage-using-HTTP-GET/Program.cs +++ b/HTML to PDF/Blink/Access-a-webpage-using-HTTP-GET/.NET/Access-a-webpage-using-HTTP-GET/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,11 +16,7 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert(urlToConvert); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Access-a-webpage-using-HTTP-POST/.NET/Access-a-webpage-using-HTTP-POST/Program.cs b/HTML to PDF/Blink/Access-a-webpage-using-HTTP-POST/.NET/Access-a-webpage-using-HTTP-POST/Program.cs index 0f889d96..41f2894d 100644 --- a/HTML to PDF/Blink/Access-a-webpage-using-HTTP-POST/.NET/Access-a-webpage-using-HTTP-POST/Program.cs +++ b/HTML to PDF/Blink/Access-a-webpage-using-HTTP-POST/.NET/Access-a-webpage-using-HTTP-POST/Program.cs @@ -2,7 +2,6 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,11 +18,7 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.example.com"); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs index d16b4071..bc040861 100644 --- a/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs +++ b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs @@ -1,6 +1,5 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -12,11 +11,8 @@ htmlConverter.ConverterSettings = settings; //Convert URL to PDF. PdfDocument document = htmlConverter.Convert("file:///D:/PDF-Examples/HTML%20to%20PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible%20PDF/Data/Input.html"); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} + +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Adding-signature-field-to-PDF-converted-from-HTML/.NET/Adding-signature-field-to-PDF-converted-from-HTML/Program.cs b/HTML to PDF/Blink/Adding-signature-field-to-PDF-converted-from-HTML/.NET/Adding-signature-field-to-PDF-converted-from-HTML/Program.cs index 3b9396c6..edcf87d0 100644 --- a/HTML to PDF/Blink/Adding-signature-field-to-PDF-converted-from-HTML/.NET/Adding-signature-field-to-PDF-converted-from-HTML/Program.cs +++ b/HTML to PDF/Blink/Adding-signature-field-to-PDF-converted-from-HTML/.NET/Adding-signature-field-to-PDF-converted-from-HTML/Program.cs @@ -27,9 +27,9 @@ static void Main(string[] args) // Save the PDF to a memory stream for further processing using (MemoryStream stream = new MemoryStream()) { - document.Save(stream); // Save converted PDF to memory - stream.Position = 0; // Reset stream position - document.Close(true); // Close the original document + document.Save(stream); + stream.Position = 0; + document.Close(true); // Replace the "signature" textarea with an actual signature field AddPdfSignatureField(stream); @@ -67,11 +67,8 @@ static void AddPdfSignatureField(MemoryStream stream) loadedForm.Fields.Add(signatureField); } - // Save the modified document to disk - using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write)) - { - loadedDocument.Save(outputStream); - } + // Save the modified document + loadedDocument.Save(Path.GetFullPath(@"Output/Output.pdf")); // Close the document and release resources loadedDocument.Close(true); } diff --git a/HTML to PDF/Blink/Adjusting-the-HTML-content-size-in-PDF-document/.NET/Adjusting-the-HTML-content-size-in-PDF-document/Program.cs b/HTML to PDF/Blink/Adjusting-the-HTML-content-size-in-PDF-document/.NET/Adjusting-the-HTML-content-size-in-PDF-document/Program.cs index 4a6648ee..5518fb4f 100644 --- a/HTML to PDF/Blink/Adjusting-the-HTML-content-size-in-PDF-document/.NET/Adjusting-the-HTML-content-size-in-PDF-document/Program.cs +++ b/HTML to PDF/Blink/Adjusting-the-HTML-content-size-in-PDF-document/.NET/Adjusting-the-HTML-content-size-in-PDF-document/Program.cs @@ -1,9 +1,6 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.Drawing; +using Syncfusion.Drawing; using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,11 +16,8 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.google.com"); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); + //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Convert-HTML-form-to-PDF-fillable-form/.NET/Convert-HTML-form-to-PDF-fillable-form/Program.cs b/HTML to PDF/Blink/Convert-HTML-form-to-PDF-fillable-form/.NET/Convert-HTML-form-to-PDF-fillable-form/Program.cs index 5015b59d..e0c9d19b 100644 --- a/HTML to PDF/Blink/Convert-HTML-form-to-PDF-fillable-form/.NET/Convert-HTML-form-to-PDF-fillable-form/Program.cs +++ b/HTML to PDF/Blink/Convert-HTML-form-to-PDF-fillable-form/.NET/Convert-HTML-form-to-PDF-fillable-form/Program.cs @@ -1,9 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; - //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,11 +15,8 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html")); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); + //Close the document. document.Close(true); \ No newline at end of file diff --git a/HTML to PDF/Blink/Convert-HTML-to-PDF-in-offline-mode/.NET/Convert-HTML-to-PDF-in-offline-mode/Program.cs b/HTML to PDF/Blink/Convert-HTML-to-PDF-in-offline-mode/.NET/Convert-HTML-to-PDF-in-offline-mode/Program.cs index c828f613..9a7730ba 100644 --- a/HTML to PDF/Blink/Convert-HTML-to-PDF-in-offline-mode/.NET/Convert-HTML-to-PDF-in-offline-mode/Program.cs +++ b/HTML to PDF/Blink/Convert-HTML-to-PDF-in-offline-mode/.NET/Convert-HTML-to-PDF-in-offline-mode/Program.cs @@ -1,6 +1,4 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; using System.Runtime.InteropServices; @@ -19,11 +17,7 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.google.com"); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(fileStream); //Close the document. document.Close(true); \ No newline at end of file diff --git a/HTML to PDF/Blink/Convert-form-authenticated-webpage-to-PDF-document/.NET/Convert-form-authenticated-webpage-to-PDF-document/Program.cs b/HTML to PDF/Blink/Convert-form-authenticated-webpage-to-PDF-document/.NET/Convert-form-authenticated-webpage-to-PDF-document/Program.cs index a2089029..7b0c3907 100644 --- a/HTML to PDF/Blink/Convert-form-authenticated-webpage-to-PDF-document/.NET/Convert-form-authenticated-webpage-to-PDF-document/Program.cs +++ b/HTML to PDF/Blink/Convert-form-authenticated-webpage-to-PDF-document/.NET/Convert-form-authenticated-webpage-to-PDF-document/Program.cs @@ -1,9 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; - //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -20,11 +16,7 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.example.com"); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Convert-partial-webpage-to-PDF-document/.NET/Convert-partial-webpage-to-PDF-document/Program.cs b/HTML to PDF/Blink/Convert-partial-webpage-to-PDF-document/.NET/Convert-partial-webpage-to-PDF-document/Program.cs index baa45b2b..c1c98d23 100644 --- a/HTML to PDF/Blink/Convert-partial-webpage-to-PDF-document/.NET/Convert-partial-webpage-to-PDF-document/Program.cs +++ b/HTML to PDF/Blink/Convert-partial-webpage-to-PDF-document/.NET/Convert-partial-webpage-to-PDF-document/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -10,11 +7,7 @@ //Convert Partial webpage to PDF document. PdfDocument document = htmlConverter.ConvertPartialHtml(Path.GetFullPath(@"Data/Input.html"), "picture"); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); \ No newline at end of file diff --git a/HTML to PDF/Blink/Convert-the-HTML-string-to-PDF-document/.NET/Convert-the-HTML-string-to-PDF-document/Program.cs b/HTML to PDF/Blink/Convert-the-HTML-string-to-PDF-document/.NET/Convert-the-HTML-string-to-PDF-document/Program.cs index 39679134..abab8e22 100644 --- a/HTML to PDF/Blink/Convert-the-HTML-string-to-PDF-document/.NET/Convert-the-HTML-string-to-PDF-document/Program.cs +++ b/HTML to PDF/Blink/Convert-the-HTML-string-to-PDF-document/.NET/Convert-the-HTML-string-to-PDF-document/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -13,11 +10,7 @@ //Convert HTML string to PDF document. PdfDocument document = htmlConverter.Convert(htmlText, baseUrl); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Convert-the-HTML-string-to-image-file/.NET/Convert-the-HTML-string-to-image-file/Program.cs b/HTML to PDF/Blink/Convert-the-HTML-string-to-image-file/.NET/Convert-the-HTML-string-to-image-file/Program.cs index e58394c1..f6d870a1 100644 --- a/HTML to PDF/Blink/Convert-the-HTML-string-to-image-file/.NET/Convert-the-HTML-string-to-image-file/Program.cs +++ b/HTML to PDF/Blink/Convert-the-HTML-string-to-image-file/.NET/Convert-the-HTML-string-to-image-file/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.Drawing; +using Syncfusion.Drawing; using Syncfusion.HtmlConverter; -using System.Runtime.InteropServices; //Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); diff --git a/HTML to PDF/Blink/Convert-token-based-authenticated-webpage-to-PDF/.NET/Convert-token-based-authenticated-webpage-to-PDF/Program.cs b/HTML to PDF/Blink/Convert-token-based-authenticated-webpage-to-PDF/.NET/Convert-token-based-authenticated-webpage-to-PDF/Program.cs index f5534947..0268b202 100644 --- a/HTML to PDF/Blink/Convert-token-based-authenticated-webpage-to-PDF/.NET/Convert-token-based-authenticated-webpage-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Convert-token-based-authenticated-webpage-to-PDF/.NET/Convert-token-based-authenticated-webpage-to-PDF/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,11 +16,7 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://httpbin.org/headers"); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); 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 cc1e0f64..42efaaeb 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 @@ -1,6 +1,4 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; //Initialize HTML to PDF converter. @@ -12,11 +10,8 @@ htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.google.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); -} + +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Convert-website-URL-to-image-file/.NET/Convert-website-URL-to-image-file/Program.cs b/HTML to PDF/Blink/Convert-website-URL-to-image-file/.NET/Convert-website-URL-to-image-file/Program.cs index e676fee7..2619bd79 100644 --- a/HTML to PDF/Blink/Convert-website-URL-to-image-file/.NET/Convert-website-URL-to-image-file/Program.cs +++ b/HTML to PDF/Blink/Convert-website-URL-to-image-file/.NET/Convert-website-URL-to-image-file/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.Drawing; +using Syncfusion.Drawing; using Syncfusion.HtmlConverter; -using System.Runtime.InteropServices; //Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); diff --git a/HTML to PDF/Blink/Convert-windows-authenticated-webpage-to-PDF-document/.NET/Convert-windows-authenticated-webpage-to-PDF-document/Program.cs b/HTML to PDF/Blink/Convert-windows-authenticated-webpage-to-PDF-document/.NET/Convert-windows-authenticated-webpage-to-PDF-document/Program.cs index 5ce8f207..b8c43d5b 100644 --- a/HTML to PDF/Blink/Convert-windows-authenticated-webpage-to-PDF-document/.NET/Convert-windows-authenticated-webpage-to-PDF-document/Program.cs +++ b/HTML to PDF/Blink/Convert-windows-authenticated-webpage-to-PDF-document/.NET/Convert-windows-authenticated-webpage-to-PDF-document/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -20,11 +17,7 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.example.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); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Create-TOC-while-converting-HTML-to-PDF/.NET/Create-TOC-while-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Create-TOC-while-converting-HTML-to-PDF/.NET/Create-TOC-while-converting-HTML-to-PDF/Program.cs index 84ea7a43..76451e30 100644 --- a/HTML to PDF/Blink/Create-TOC-while-converting-HTML-to-PDF/.NET/Create-TOC-while-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Create-TOC-while-converting-HTML-to-PDF/.NET/Create-TOC-while-converting-HTML-to-PDF/Program.cs @@ -2,7 +2,6 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,11 +18,7 @@ //Convert HTML to PDF document. PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html")); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Create-custom-style-TOC-when-converting-HTML-to-PDF/.NET/Create-custom-style-TOC-when-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Create-custom-style-TOC-when-converting-HTML-to-PDF/.NET/Create-custom-style-TOC-when-converting-HTML-to-PDF/Program.cs index e0fa46f4..2ed2ddb3 100644 --- a/HTML to PDF/Blink/Create-custom-style-TOC-when-converting-HTML-to-PDF/.NET/Create-custom-style-TOC-when-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Create-custom-style-TOC-when-converting-HTML-to-PDF/.NET/Create-custom-style-TOC-when-converting-HTML-to-PDF/Program.cs @@ -1,11 +1,8 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.Drawing; +using Syncfusion.Drawing; using Syncfusion.HtmlConverter; using Syncfusion.Pdf; using Syncfusion.Pdf.Graphics; using Syncfusion.Pdf.HtmlToPdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -30,11 +27,7 @@ //Convert HTML to PDF document. PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html")); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Creating-bookmarks-while-converting-HTML-to-PDF/.NET/Creating-bookmarks-while-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Creating-bookmarks-while-converting-HTML-to-PDF/.NET/Creating-bookmarks-while-converting-HTML-to-PDF/Program.cs index c3c914ac..4b6b38ac 100644 --- a/HTML to PDF/Blink/Creating-bookmarks-while-converting-HTML-to-PDF/.NET/Creating-bookmarks-while-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Creating-bookmarks-while-converting-HTML-to-PDF/.NET/Creating-bookmarks-while-converting-HTML-to-PDF/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,11 +16,7 @@ //Convert HTML to PDF document. PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html")); -//Create file stream. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document - document.Save(fileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Disable-JavaScript-when-convert-HTML-to-PDF/.NET/Disable-JavaScript-when-convert-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Disable-JavaScript-when-convert-HTML-to-PDF/.NET/Disable-JavaScript-when-convert-HTML-to-PDF/Program.cs index a5adfca8..75b70e6f 100644 --- a/HTML to PDF/Blink/Disable-JavaScript-when-convert-HTML-to-PDF/.NET/Disable-JavaScript-when-convert-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Disable-JavaScript-when-convert-HTML-to-PDF/.NET/Disable-JavaScript-when-convert-HTML-to-PDF/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,12 +16,8 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.google.com"); -//Create file stream. -using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document to file stream. - document.Save(outputFileStream); -} +//Save the PDF document to file stream. +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Disable-URL-links-while-converting-HTML-to-PDF/.NET/Disable-URL-links-while-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Disable-URL-links-while-converting-HTML-to-PDF/.NET/Disable-URL-links-while-converting-HTML-to-PDF/Program.cs index e068cfb3..5c5229a9 100644 --- a/HTML to PDF/Blink/Disable-URL-links-while-converting-HTML-to-PDF/.NET/Disable-URL-links-while-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Disable-URL-links-while-converting-HTML-to-PDF/.NET/Disable-URL-links-while-converting-HTML-to-PDF/Program.cs @@ -1,8 +1,5 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -19,12 +16,8 @@ //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.google.com"); -//Create file stream. -using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document to file stream. - document.Save(outputFileStream); -} +//Save the PDF document to file stream. +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Disabling-local-file-access-HTML-to-PDF/.NET/Disabling-local-file-access-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Disabling-local-file-access-HTML-to-PDF/.NET/Disabling-local-file-access-HTML-to-PDF/Program.cs index 948956fc..5c47b895 100644 --- a/HTML to PDF/Blink/Disabling-local-file-access-HTML-to-PDF/.NET/Disabling-local-file-access-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Disabling-local-file-access-HTML-to-PDF/.NET/Disabling-local-file-access-HTML-to-PDF/Program.cs @@ -1,5 +1,4 @@ - -using Syncfusion.Drawing; +using Syncfusion.Drawing; using Syncfusion.HtmlConverter; using Syncfusion.Pdf; @@ -21,10 +20,6 @@ // Convert HTML to PDF document using (PdfDocument document = htmlConverter.Convert(html, "")) { - // Create a file stream with a using statement to ensure disposal - using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) - { - // Save the PDF document to the file stream - document.Save(fileStream); - } + // Save the PDF document to the file stream + document.Save(Path.GetFullPath(@"Output/Output.pdf")); } diff --git a/HTML to PDF/Blink/Get-height-of-HTML-content-in-PDF/.NET/Get-height-of-HTML-content-in-PDF/Program.cs b/HTML to PDF/Blink/Get-height-of-HTML-content-in-PDF/.NET/Get-height-of-HTML-content-in-PDF/Program.cs index d5fdcb26..00263899 100644 --- a/HTML to PDF/Blink/Get-height-of-HTML-content-in-PDF/.NET/Get-height-of-HTML-content-in-PDF/Program.cs +++ b/HTML to PDF/Blink/Get-height-of-HTML-content-in-PDF/.NET/Get-height-of-HTML-content-in-PDF/Program.cs @@ -1,10 +1,7 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf.Graphics; using Syncfusion.Pdf; using Syncfusion.Drawing; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -17,12 +14,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 11); document.Pages[document.Pages.Count - 1].Graphics.DrawString("End of HTML content", font, PdfBrushes.Red, new PointF(0, layoutResult.Bounds.Bottom)); -//Create file stream. -using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/HTML-to-PDF.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the PDF document to file stream. - document.Save(outputFileStream); -} +//Save the PDF document to file stream. +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/Program.cs b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/Program.cs index 838b2def..6b83d824 100644 --- a/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/Program.cs +++ b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/Program.cs @@ -2,7 +2,6 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; using Syncfusion.Drawing; -using System.Runtime.InteropServices; HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Initialize blink converter settings. @@ -22,11 +21,7 @@ //Convert the URL to a PDF document. PdfDocument document = htmlConverter.Convert("