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("
Hello World
",string.Empty); -//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/HTML-Header-and-Footer/.NET/HTML-Header-and-Footer/Program.cs b/HTML to PDF/Blink/HTML-Header-and-Footer/.NET/HTML-Header-and-Footer/Program.cs index c28f2f9d..eff65cdb 100644 --- a/HTML to PDF/Blink/HTML-Header-and-Footer/.NET/HTML-Header-and-Footer/Program.cs +++ b/HTML to PDF/Blink/HTML-Header-and-Footer/.NET/HTML-Header-and-Footer/Program.cs @@ -1,7 +1,6 @@ using Syncfusion.Drawing; using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; namespace HTML_Header_and_Footer { internal class Program { @@ -27,13 +26,8 @@ static void Main(string[] args) { htmlConverter.ConverterSettings = blinkConverterSettings; //Convert the URL to a 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); - } + //Save the PDF document + document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); } diff --git a/HTML to PDF/Blink/HTML-to-PDF-Enable-Autoscaling/.NET/HTML-to-PDF-Enable-Autoscaling/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-Enable-Autoscaling/.NET/HTML-to-PDF-Enable-Autoscaling/Program.cs index 46026888..dce7a6df 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-Enable-Autoscaling/.NET/HTML-to-PDF-Enable-Autoscaling/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-Enable-Autoscaling/.NET/HTML-to-PDF-Enable-Autoscaling/Program.cs @@ -1,6 +1,5 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; // Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -13,9 +12,7 @@ // Converts the HTML file to a PDF document, using the path of the HTML file. PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html")); // Save the generated PDF document to a specified output file. -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create)) -{ - document.Save(fileStream); -} +document.Save(Path.GetFullPath(@"Output/Output.pdf")); + // Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/HTML-to-PDF-Header-and-footer/.NET/HTML-to-PDF-Header-and-footer/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-Header-and-footer/.NET/HTML-to-PDF-Header-and-footer/Program.cs index bc3c0d4c..81e80df6 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-Header-and-footer/.NET/HTML-to-PDF-Header-and-footer/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-Header-and-footer/.NET/HTML-to-PDF-Header-and-footer/Program.cs @@ -2,7 +2,6 @@ using Syncfusion.Pdf.Graphics; using Syncfusion.Pdf; using Syncfusion.Drawing; -using System.Runtime.InteropServices; namespace HTML_to_PDF_Header_and_footer { internal class Program { @@ -36,13 +35,8 @@ static void Main(string[] args) { htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF. 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/HTML-to-PDF-TOC-Arabic-Text/.NET/HTML-to-PDF-TOC-Arabic-Text/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-TOC-Arabic-Text/.NET/HTML-to-PDF-TOC-Arabic-Text/Program.cs index 8977463b..b077fe2a 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-TOC-Arabic-Text/.NET/HTML-to-PDF-TOC-Arabic-Text/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-TOC-Arabic-Text/.NET/HTML-to-PDF-TOC-Arabic-Text/Program.cs @@ -28,11 +28,8 @@ htmlConverter.ConverterSettings = settings; //Convert HTML to PDF document. PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/input1.html")); -//Create file stream to save the PDF document. -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 PDF document document.Close(true); diff --git a/HTML to PDF/Blink/HTML-to-PDF-Wait-For-External-Fonts/.NET/HTML-to-PDF-Wait-For-External-Fonts/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-Wait-For-External-Fonts/.NET/HTML-to-PDF-Wait-For-External-Fonts/Program.cs index 5730d8a0..2fd7cf1e 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-Wait-For-External-Fonts/.NET/HTML-to-PDF-Wait-For-External-Fonts/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-Wait-For-External-Fonts/.NET/HTML-to-PDF-Wait-For-External-Fonts/Program.cs @@ -13,11 +13,7 @@ //Convert URL to PDF PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data\Input.html")); -// Create a FileStream to save the PDF document to a file -using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create)) -{ - // Save the PDF document to the file stream - document.Save(fileStream); -} +// Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); // Close the document after saving document.Close(true); \ No newline at end of file diff --git a/HTML to PDF/Blink/HTML-to-PDF-margin-customization/.NET/HTML-to-PDF-margin-customization/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-margin-customization/.NET/HTML-to-PDF-margin-customization/Program.cs index 7e3f7dd5..b7b55271 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-margin-customization/.NET/HTML-to-PDF-margin-customization/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-margin-customization/.NET/HTML-to-PDF-margin-customization/Program.cs @@ -1,6 +1,5 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; namespace HTML_to_PDF_margin_customization { internal class Program { @@ -16,12 +15,8 @@ static void Main(string[] args) { //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/HTML-to-PDF-page-orientation-customization/.NET/HTML-to-PDF-page-orientation-customization/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-page-orientation-customization/.NET/HTML-to-PDF-page-orientation-customization/Program.cs index 8d310a91..ac955859 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-page-orientation-customization/.NET/HTML-to-PDF-page-orientation-customization/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-page-orientation-customization/.NET/HTML-to-PDF-page-orientation-customization/Program.cs @@ -1,6 +1,5 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; namespace HTML_to_PDF_page_orientation_customization { internal class Program { @@ -16,12 +15,8 @@ static void Main(string[] args) { //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/HTML-to-PDF-page-size-customization/.NET/HTML-to-PDF-page-size-customization/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-page-size-customization/.NET/HTML-to-PDF-page-size-customization/Program.cs index 9747d6ea..a9abafa2 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-page-size-customization/.NET/HTML-to-PDF-page-size-customization/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-page-size-customization/.NET/HTML-to-PDF-page-size-customization/Program.cs @@ -1,6 +1,5 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; namespace HTML_to_PDF_page_size_customization { internal class Program { @@ -16,12 +15,8 @@ static void Main(string[] args) { //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/HTML-to-PDF-rotate-page/.NET/HTML-to-PDF-rotate-page/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-rotate-page/.NET/HTML-to-PDF-rotate-page/Program.cs index 263468b6..95ab2f42 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-rotate-page/.NET/HTML-to-PDF-rotate-page/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-rotate-page/.NET/HTML-to-PDF-rotate-page/Program.cs @@ -1,6 +1,5 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; namespace HTML_to_PDF_rotate_page { internal class Program { @@ -16,12 +15,8 @@ static void Main(string[] args) { //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/HTML-to-PDF-scale-property/.NET/Scale_property_in_HTML_converter/Program.cs b/HTML to PDF/Blink/HTML-to-PDF-scale-property/.NET/Scale_property_in_HTML_converter/Program.cs index 89b3198a..eb418f31 100644 --- a/HTML to PDF/Blink/HTML-to-PDF-scale-property/.NET/Scale_property_in_HTML_converter/Program.cs +++ b/HTML to PDF/Blink/HTML-to-PDF-scale-property/.NET/Scale_property_in_HTML_converter/Program.cs @@ -1,7 +1,6 @@  using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -13,11 +12,8 @@ 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); -} + +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Header-And-Footer-For-Specific-Page/.NET/HeaderAndFooterForSpecificPage/Program.cs b/HTML to PDF/Blink/Header-And-Footer-For-Specific-Page/.NET/HeaderAndFooterForSpecificPage/Program.cs index 6567afc3..6fa7cb95 100644 --- a/HTML to PDF/Blink/Header-And-Footer-For-Specific-Page/.NET/HeaderAndFooterForSpecificPage/Program.cs +++ b/HTML to PDF/Blink/Header-And-Footer-For-Specific-Page/.NET/HeaderAndFooterForSpecificPage/Program.cs @@ -23,19 +23,13 @@ { Directory.CreateDirectory("Output"); } - using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output-HTML-To-PDF.pdf"), FileMode.OpenOrCreate, FileAccess.ReadWrite)) - { // Save the converted PDF document - document.Save(fileStream); - } + document.Save(Path.GetFullPath(@"Output/Output.pdf")); } htmlConverter.Close(); -// Load the source -using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Output/Output-HTML-To-PDF.pdf"), FileMode.Open, FileAccess.Read)) -{ //Load the converted document - using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream)) + using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Path.GetFullPath(@"Output/Output.pdf"))) { // Define pages requiring headers @@ -83,14 +77,10 @@ destPage.Graphics.DrawPdfTemplate(contentTemplate, new PointF(0, 0)); } } - using (FileStream fileStream1 = new FileStream(Path.GetFullPath(@"Output/Output-With-HeaderAndFooter.pdf"), FileMode.Create, FileAccess.ReadWrite)) - { // Save the converted PDF document - finalDocument.Save(fileStream1); - } + finalDocument.Save(Path.GetFullPath(@"Output/Output-With-HeaderandFooter.pdf")); } } -} static void AddHeaderAndFooter(PdfPage page, string headerText, string footerText, PdfFont font) { diff --git a/HTML to PDF/Blink/HtmlToPdfWithUnicodeTOC/.NET/HtmlToPdfWithUnicodeTOC/Program.cs b/HTML to PDF/Blink/HtmlToPdfWithUnicodeTOC/.NET/HtmlToPdfWithUnicodeTOC/Program.cs index 46913283..e814410b 100644 --- a/HTML to PDF/Blink/HtmlToPdfWithUnicodeTOC/.NET/HtmlToPdfWithUnicodeTOC/Program.cs +++ b/HTML to PDF/Blink/HtmlToPdfWithUnicodeTOC/.NET/HtmlToPdfWithUnicodeTOC/Program.cs @@ -35,11 +35,8 @@ // Convert HTML to PDF PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html")); - // Save and close the PDF document - using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) - { - document.Save(fileStream); - } + //Save the PDF document + document.Save(fileStream); //Close the PDF document document.Close(true); } diff --git a/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs index 435ba162..f982f879 100644 --- a/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs +++ b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs @@ -1,7 +1,6 @@  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/Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML/Program.cs b/HTML to PDF/Blink/Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML/Program.cs index 0bd2b8f6..2a16c564 100644 --- a/HTML to PDF/Blink/Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML/Program.cs +++ b/HTML to PDF/Blink/Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML/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(); @@ -17,11 +14,7 @@ //Convert the 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); \ No newline at end of file diff --git a/HTML to PDF/Blink/Inject_custom_JavaScript_to_HTML/.NET/Inject_custom_JavaScript_to_HTML/Program.cs b/HTML to PDF/Blink/Inject_custom_JavaScript_to_HTML/.NET/Inject_custom_JavaScript_to_HTML/Program.cs index ed81a24b..2154b1ea 100644 --- a/HTML to PDF/Blink/Inject_custom_JavaScript_to_HTML/.NET/Inject_custom_JavaScript_to_HTML/Program.cs +++ b/HTML to PDF/Blink/Inject_custom_JavaScript_to_HTML/.NET/Inject_custom_JavaScript_to_HTML/Program.cs @@ -1,10 +1,7 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.Drawing; +using Syncfusion.Drawing; using Syncfusion.HtmlConverter; using Syncfusion.Pdf; using System.IO; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -22,11 +19,7 @@ //Convert the 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); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/MHTML-to-PDF/.NET/MHTML-to-PDF/Program.cs b/HTML to PDF/Blink/MHTML-to-PDF/.NET/MHTML-to-PDF/Program.cs index 5b5306f4..ffb9bcd2 100644 --- a/HTML to PDF/Blink/MHTML-to-PDF/.NET/MHTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/MHTML-to-PDF/.NET/MHTML-to-PDF/Program.cs @@ -7,10 +7,7 @@ // Convert the MHTML content (as a string) to PDF PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.mhtml")); -// Save the PDF document to a file -using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) -{ - document.Save(outputFileStream); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); // Close the PDF document document.Close(true); diff --git a/HTML to PDF/Blink/Optimize-HTML-to-PDF-performance/.NET/Optimize-HTML-to-PDF-performance/Program.cs b/HTML to PDF/Blink/Optimize-HTML-to-PDF-performance/.NET/Optimize-HTML-to-PDF-performance/Program.cs index 6a4e6b18..40ddeaa9 100644 --- a/HTML to PDF/Blink/Optimize-HTML-to-PDF-performance/.NET/Optimize-HTML-to-PDF-performance/Program.cs +++ b/HTML to PDF/Blink/Optimize-HTML-to-PDF-performance/.NET/Optimize-HTML-to-PDF-performance/Program.cs @@ -1,9 +1,6 @@ -// See https://aka.ms/new-console-template for more information - -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; using System.IO; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); diff --git a/HTML to PDF/Blink/Selection-of-media-type-while-converting-HTML-to-PDF/.NET/Selection-of-media-type-while-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Selection-of-media-type-while-converting-HTML-to-PDF/.NET/Selection-of-media-type-while-converting-HTML-to-PDF/Program.cs index 278fb11b..0ef94fad 100644 --- a/HTML to PDF/Blink/Selection-of-media-type-while-converting-HTML-to-PDF/.NET/Selection-of-media-type-while-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Selection-of-media-type-while-converting-HTML-to-PDF/.NET/Selection-of-media-type-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 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); \ No newline at end of file diff --git a/HTML to PDF/Blink/Set-additional-delay-while-converting-HTML-to-PDF/.NET/Set-additional-delay-while-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Set-additional-delay-while-converting-HTML-to-PDF/.NET/Set-additional-delay-while-converting-HTML-to-PDF/Program.cs index 98b315e3..6e482544 100644 --- a/HTML to PDF/Blink/Set-additional-delay-while-converting-HTML-to-PDF/.NET/Set-additional-delay-while-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Set-additional-delay-while-converting-HTML-to-PDF/.NET/Set-additional-delay-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 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/Set-temporary-path-while-converting-HTML-to-PDF/.NET/Set-temporary-path-while-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Set-temporary-path-while-converting-HTML-to-PDF/.NET/Set-temporary-path-while-converting-HTML-to-PDF/Program.cs index 6a710c17..07cb33ab 100644 --- a/HTML to PDF/Blink/Set-temporary-path-while-converting-HTML-to-PDF/.NET/Set-temporary-path-while-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Set-temporary-path-while-converting-HTML-to-PDF/.NET/Set-temporary-path-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,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/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/Set-windows-status-while-converting-HTML-to-PDF/.NET/Set-windows-status-while-converting-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Set-windows-status-while-converting-HTML-to-PDF/.NET/Set-windows-status-while-converting-HTML-to-PDF/Program.cs index 80d64e7f..e9ad246d 100644 --- a/HTML to PDF/Blink/Set-windows-status-while-converting-HTML-to-PDF/.NET/Set-windows-status-while-converting-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Set-windows-status-while-converting-HTML-to-PDF/.NET/Set-windows-status-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 URL 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/Set_blink_path_in_HTML_to_PDF/.NET/Set_blink_path_in_HTML_to_PDF/Program.cs b/HTML to PDF/Blink/Set_blink_path_in_HTML_to_PDF/.NET/Set_blink_path_in_HTML_to_PDF/Program.cs index 91d11f57..ab764f3a 100644 --- a/HTML to PDF/Blink/Set_blink_path_in_HTML_to_PDF/.NET/Set_blink_path_in_HTML_to_PDF/Program.cs +++ b/HTML to PDF/Blink/Set_blink_path_in_HTML_to_PDF/.NET/Set_blink_path_in_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 HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -14,11 +11,7 @@ //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); -} +//Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); //Close the document. document.Close(true); diff --git a/HTML to PDF/Blink/Time-out-support-in-HTML-to-PDF/.NET/Time-out-support-in-HTML-to-PDF/Program.cs b/HTML to PDF/Blink/Time-out-support-in-HTML-to-PDF/.NET/Time-out-support-in-HTML-to-PDF/Program.cs index eaf5dff1..b29bdb6f 100644 --- a/HTML to PDF/Blink/Time-out-support-in-HTML-to-PDF/.NET/Time-out-support-in-HTML-to-PDF/Program.cs +++ b/HTML to PDF/Blink/Time-out-support-in-HTML-to-PDF/.NET/Time-out-support-in-HTML-to-PDF/Program.cs @@ -1,7 +1,5 @@ -//Initialize the HTML to PDF converter. -using Syncfusion.HtmlConverter; +using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -using System.Runtime.InteropServices; //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -13,11 +11,8 @@ htmlConverter.ConverterSettings = blinkConverterSettings; //Convert URL to PDF 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);