Skip to content

Commit 4e40231

Browse files
Merge pull request #224 from SyncfusionExamples/994279
994279: Added code sample for skip cover page in TOC page numbers.
2 parents 21f3bdc + fec62db commit 4e40231

File tree

6 files changed

+170
-0
lines changed

6 files changed

+170
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36616.10 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
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}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{FCE9AE2D-9986-40DD-8B98-51ABE5153F05}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {3898E2C3-F03F-4683-BB97-33F65A23EBAA}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="logo" style="text-align:center">
2+
<img src="https://cdn.syncfusion.com/content/images/company-logos/Syncfusion_Logo_Image.png" alt="Syncfusion Logo" width="180"/>
3+
</div>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<title>Syncfusion Product Overview</title>
6+
<style>
7+
body {
8+
font-family: Arial, sans-serif;
9+
margin: 20px;
10+
}
11+
h1, h2 {
12+
color: #333;
13+
}
14+
h1{
15+
page-break-before:always;
16+
}
17+
.logo {
18+
text-align: center;
19+
margin-bottom: 20px;
20+
}
21+
table {
22+
width: 100%;
23+
border-collapse: collapse;
24+
margin-bottom: 30px;
25+
}
26+
th, td {
27+
border: 1px solid #333;
28+
padding: 8px;
29+
text-align: left;
30+
}
31+
th {
32+
background-color: #f4f4f4;
33+
}
34+
</style>
35+
</head>
36+
<body>
37+
<!-- Introduction -->
38+
<h1>Introduction</h1>
39+
<p>
40+
Syncfusion provides a comprehensive suite of UI components and tools for web, desktop, and mobile development.
41+
</p>
42+
43+
<!-- Section 1: Essential Studio -->
44+
<h1>Section 1: Essential Studio</h1>
45+
<p>
46+
Essential Studio is a collection of over 1,700 components and frameworks for building modern applications.
47+
</p>
48+
<h2>Popular Platforms</h2>
49+
<ul>
50+
<li>ASP.NET Core</li>
51+
<li>Blazor</li>
52+
<li>Angular</li>
53+
<li>React</li>
54+
<li>Xamarin</li>
55+
</ul>
56+
57+
<!-- Section 2: Key Features -->
58+
<h1>Section 2: Key Features</h1>
59+
<p>
60+
Syncfusion offers features like charts, grids, PDF generation, and reporting tools.
61+
</p>
62+
<h2>Feature Highlights</h2>
63+
<table>
64+
<thead>
65+
<tr>
66+
<th>Feature</th>
67+
<th>Description</th>
68+
</tr>
69+
</thead>
70+
<tbody>
71+
<tr><td>DataGrid</td><td>High-performance grid with sorting, filtering, and grouping.</td></tr>
72+
<tr><td>Charts</td><td>Interactive charts for data visualization.</td></tr>
73+
<tr><td>PDF Library</td><td>Create and manipulate PDF documents programmatically.</td></tr>
74+
<tr><td>File Formats</td><td>Work with Excel, Word, and PowerPoint files.</td></tr>
75+
</tbody>
76+
</table>
77+
78+
<!-- Section 3: Licensing Information -->
79+
<h1>Section 3: Licensing Information</h1>
80+
<p>
81+
Syncfusion offers commercial licenses and a free community license for eligible developers.
82+
</p>
83+
84+
<!-- Section 4: Support and Resources -->
85+
<h1>Section 4: Support and Resources</h1>
86+
<p>
87+
Access our support portal for assistance. You can also join our community forums.
88+
</p>
89+
90+
</body>
91+
</html>

HTML to PDF/Blink/Skip-cover-page-in-TOC-page-numbering/.NET/Skip-cover-page-in-TOC-page-numbering/Output/gitkeep.txt

Whitespace-only changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Syncfusion.Drawing;
2+
using Syncfusion.HtmlConverter;
3+
using Syncfusion.Pdf;
4+
5+
// Create an instance of HTML-to-PDF converter
6+
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
7+
// Configure Blink converter settings
8+
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings()
9+
{
10+
ViewPortSize = new Size(1280, 0), // Set viewport width for rendering
11+
EnableToc = true, // Enable Table of Contents (TOC)
12+
};
13+
// Set TOC starting page number to skip the cover page
14+
blinkConverterSettings.Toc.StartingPageNumber = 1;
15+
// Apply the settings to the converter
16+
htmlConverter.ConverterSettings = blinkConverterSettings;
17+
// Read the main HTML content and convert it to PDF
18+
string inputhtml = File.ReadAllText(Path.GetFullPath(@"Data/input.html"));
19+
PdfDocument document = htmlConverter.Convert(inputhtml, "");
20+
//Create cover page and insert to the 0th index.
21+
// Apply scaling settings for the cover page
22+
htmlConverter.ConverterSettings = new BlinkConverterSettings()
23+
{
24+
Scale = 1.5f
25+
};
26+
// Convert the cover page HTML to PDF
27+
string coverimage = File.ReadAllText(Path.GetFullPath(@"Data/coverpage.html"));
28+
PdfDocument coverPage = htmlConverter.Convert(coverimage, "");
29+
// Insert the cover page at the beginning of the main document
30+
document.Pages.Insert(0, coverPage.Pages[0]);
31+
// Save the PDF document
32+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
33+
//Dispose the document
34+
coverPage.Close(true);
35+
document.Close(true);
36+
htmlConverter.Close();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Skip_cover_page_in_TOC_page_numbering</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.HtmlToPdfConverter.Net.Windows" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>

0 commit comments

Comments
 (0)