From cffd040c3d2b1c97be80a7eee9f345fe86583985 Mon Sep 17 00:00:00 2001 From: sameerkhan001 Date: Fri, 21 Nov 2025 15:46:02 +0530 Subject: [PATCH 1/3] 994279: Added code sample for skip cover page in TOC page numbers. --- .../Skip-cover-page-in-TOC-page-numbering.sln | 25 +++++ .../Data/coverpage.html | 3 + .../Data/input.html | 91 +++++++++++++++++++ .../Output/gitkeep.txt | 0 .../Program.cs | 33 +++++++ ...ip-cover-page-in-TOC-page-numbering.csproj | 15 +++ 6 files changed, 167 insertions(+) create mode 100644 HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering.sln create mode 100644 HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/coverpage.html create mode 100644 HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/input.html create mode 100644 HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Output/gitkeep.txt create mode 100644 HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs create mode 100644 HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Skip-cover-page-in-TOC-page-numbering.csproj diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering.sln b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering.sln new file mode 100644 index 00000000..e19f1987 --- /dev/null +++ b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36616.10 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skip-cover-page-in-TOC-page-numbering", "Skip-cover-page-in-TOC-page-numbering\Skip-cover-page-in-TOC-page-numbering.csproj", "{FCE9AE2D-9986-40DD-8B98-51ABE5153F05}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3898E2C3-F03F-4683-BB97-33F65A23EBAA} + EndGlobalSection +EndGlobal diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/coverpage.html b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/coverpage.html new file mode 100644 index 00000000..ca31a391 --- /dev/null +++ b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/coverpage.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/input.html b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/input.html new file mode 100644 index 00000000..373c8dd9 --- /dev/null +++ b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Data/input.html @@ -0,0 +1,91 @@ + + + + + Syncfusion Product Overview + + + + +

Introduction

+

+ Syncfusion provides a comprehensive suite of UI components and tools for web, desktop, and mobile development. +

+ + +

Section 1: Essential Studio

+

+ Essential Studio is a collection of over 1,700 components and frameworks for building modern applications. +

+

Popular Platforms

+ + + +

Section 2: Key Features

+

+ Syncfusion offers features like charts, grids, PDF generation, and reporting tools. +

+

Feature Highlights

+ + + + + + + + + + + + + +
FeatureDescription
DataGridHigh-performance grid with sorting, filtering, and grouping.
ChartsInteractive charts for data visualization.
PDF LibraryCreate and manipulate PDF documents programmatically.
File FormatsWork with Excel, Word, and PowerPoint files.
+ + +

Section 3: Licensing Information

+

+ Syncfusion offers commercial licenses and a free community license for eligible developers. +

+ + +

Section 4: Support and Resources

+

+ Access our support portal for assistance. You can also join our community forums. +

+ + + diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Output/gitkeep.txt b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs new file mode 100644 index 00000000..1ed46833 --- /dev/null +++ b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs @@ -0,0 +1,33 @@ +using Syncfusion.Drawing; +using Syncfusion.HtmlConverter; +using Syncfusion.Pdf; + +// Create an instance of HTML-to-PDF converter using Blink rendering engine +HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); +// Configure Blink converter settings +BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings +{ + ViewPortSize = new Size(1280, 0), // Set viewport width for rendering + EnableToc = true, // Enable Table of Contents (TOC) +}; +// Set TOC starting page number to skip the cover page +blinkConverterSettings.Toc.StartingPageNumber = 1; +// Apply the settings to the converter +htmlConverter.ConverterSettings = blinkConverterSettings; +// Read the main HTML content and convert it to PDF +string inputhtml = File.ReadAllText(Path.GetFullPath(@"Data/input.html")); +PdfDocument document = htmlConverter.Convert(inputhtml, ""); +// Create new settings for scaling the cover page +BlinkConverterSettings settings = new BlinkConverterSettings(); +settings.Scale = 1.5f; +// Apply scaling settings +htmlConverter.ConverterSettings = settings; +// Convert the cover page HTML to PDF +string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html")); +PdfDocument coverPage = htmlConverter.Convert(coverimage, ""); +// Insert the cover page at the beginning of the main document +document.Pages.Insert(0, coverPage.Pages[0]); +// Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); +// Close the PDF document +document.Close(true); \ No newline at end of file diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Skip-cover-page-in-TOC-page-numbering.csproj b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Skip-cover-page-in-TOC-page-numbering.csproj new file mode 100644 index 00000000..57b4c631 --- /dev/null +++ b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Skip-cover-page-in-TOC-page-numbering.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Skip_cover_page_in_TOC_page_numbering + enable + enable + + + + + + + From 7c506af2750269991086250a3346c3afa642b4dd Mon Sep 17 00:00:00 2001 From: sameerkhan001 Date: Tue, 25 Nov 2025 10:37:32 +0530 Subject: [PATCH 2/3] 994279: Resolved the given feedback. --- .../Program.cs | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs index 1ed46833..5787f361 100644 --- a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs +++ b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs @@ -16,18 +16,20 @@ htmlConverter.ConverterSettings = blinkConverterSettings; // Read the main HTML content and convert it to PDF string inputhtml = File.ReadAllText(Path.GetFullPath(@"Data/input.html")); -PdfDocument document = htmlConverter.Convert(inputhtml, ""); -// Create new settings for scaling the cover page -BlinkConverterSettings settings = new BlinkConverterSettings(); -settings.Scale = 1.5f; -// Apply scaling settings -htmlConverter.ConverterSettings = settings; -// Convert the cover page HTML to PDF -string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html")); -PdfDocument coverPage = htmlConverter.Convert(coverimage, ""); -// Insert the cover page at the beginning of the main document -document.Pages.Insert(0, coverPage.Pages[0]); -// Save the PDF document -document.Save(Path.GetFullPath(@"Output/Output.pdf")); -// Close the PDF document -document.Close(true); \ No newline at end of file +using (PdfDocument document = htmlConverter.Convert(inputhtml, "")) +{ + // Apply scaling settings for the cover page + htmlConverter.ConverterSettings = new BlinkConverterSettings() + { + Scale = 1.5f + }; + // Convert the cover page HTML to PDF + string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html")); + using (PdfDocument coverPage = htmlConverter.Convert(coverimage, "")) + { + // Insert the cover page at the beginning of the main document + document.Pages.Insert(0, coverPage.Pages[0]); + // Save the PDF document + document.Save(Path.GetFullPath(@"Output/Output.pdf")); + } +} \ No newline at end of file From fec62db9a7c942523b7ef30062382d44b205dbc2 Mon Sep 17 00:00:00 2001 From: sameerkhan001 Date: Tue, 25 Nov 2025 12:34:52 +0530 Subject: [PATCH 3/3] 994279: Resolved the given feedback. --- .../Program.cs | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs index 5787f361..04c078a5 100644 --- a/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs +++ b/HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Program.cs @@ -2,10 +2,10 @@ using Syncfusion.HtmlConverter; using Syncfusion.Pdf; -// Create an instance of HTML-to-PDF converter using Blink rendering engine +// Create an instance of HTML-to-PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); // Configure Blink converter settings -BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings +BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings() { ViewPortSize = new Size(1280, 0), // Set viewport width for rendering EnableToc = true, // Enable Table of Contents (TOC) @@ -16,20 +16,21 @@ htmlConverter.ConverterSettings = blinkConverterSettings; // Read the main HTML content and convert it to PDF string inputhtml = File.ReadAllText(Path.GetFullPath(@"Data/input.html")); -using (PdfDocument document = htmlConverter.Convert(inputhtml, "")) +PdfDocument document = htmlConverter.Convert(inputhtml, ""); +//Create cover page and insert to the 0th index. +// Apply scaling settings for the cover page +htmlConverter.ConverterSettings = new BlinkConverterSettings() { - // Apply scaling settings for the cover page - htmlConverter.ConverterSettings = new BlinkConverterSettings() - { - Scale = 1.5f - }; - // Convert the cover page HTML to PDF - string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html")); - using (PdfDocument coverPage = htmlConverter.Convert(coverimage, "")) - { - // Insert the cover page at the beginning of the main document - document.Pages.Insert(0, coverPage.Pages[0]); - // Save the PDF document - document.Save(Path.GetFullPath(@"Output/Output.pdf")); - } -} \ No newline at end of file + Scale = 1.5f +}; +// Convert the cover page HTML to PDF +string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html")); +PdfDocument coverPage = htmlConverter.Convert(coverimage, ""); +// Insert the cover page at the beginning of the main document +document.Pages.Insert(0, coverPage.Pages[0]); +// Save the PDF document +document.Save(Path.GetFullPath(@"Output/Output.pdf")); +//Dispose the document +coverPage.Close(true); +document.Close(true); +htmlConverter.Close(); \ No newline at end of file