diff --git a/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles.sln b/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles.sln new file mode 100644 index 00000000..9a9a78b7 --- /dev/null +++ b/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36221.1 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Setting-Section-Page-Numbers-With-Custom-Styles", "Setting-Section-Page-Numbers-With-Custom-Styles\Setting-Section-Page-Numbers-With-Custom-Styles.csproj", "{73050DDC-B7A3-48AC-AAF9-72B3710424DC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {73050DDC-B7A3-48AC-AAF9-72B3710424DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73050DDC-B7A3-48AC-AAF9-72B3710424DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73050DDC-B7A3-48AC-AAF9-72B3710424DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73050DDC-B7A3-48AC-AAF9-72B3710424DC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BD540509-74DF-4C8F-9D94-6D807B315F6C} + EndGlobalSection +EndGlobal diff --git a/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Output/gitkeep.txt b/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Program.cs b/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Program.cs new file mode 100644 index 00000000..9126dbb6 --- /dev/null +++ b/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Program.cs @@ -0,0 +1,55 @@ +using Syncfusion.Pdf; +using Syncfusion.Pdf.Graphics; +using Syncfusion.Drawing; + +class Program +{ + static void Main(string[] args) + { + //Create a new document. + PdfDocument document = new PdfDocument(); + + //Add a section to the document. + PdfSection section = document.Sections.Add(); + + //Set the font for the page number. + PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); + + //Create a section page number field. + PdfSectionPageNumberField sectionPageNumber = new PdfSectionPageNumberField(); + + //Set the page number style to LowerRoman (i, ii, iii, etc.). + sectionPageNumber.NumberStyle = PdfNumberStyle.LowerRoman; + sectionPageNumber.Font = font; + + //Add pages to the section and draw the page number field in the footer. + for (int i = 0; i < 3; i++) + { + //Add a new page to the section. + PdfPage page = section.Pages.Add(); + + //Get the page's client size to calculate the footer position. + SizeF pageSize = page.GetClientSize(); + + //Define the position for the page number in the footer (bottom-right). + PointF footerPosition = new PointF(pageSize.Width - 50, pageSize.Height - 20); + + //Draw the section page number at the calculated footer position. + sectionPageNumber.Draw(page.Graphics, footerPosition); + + // You can add other content to the main body of the page here. + // For example, let's draw text at the top, leaving space for the footer. + page.Graphics.DrawString("This is the main content of a page with a footer.", font, PdfBrushes.Black, new PointF(10, 10)); + } + + //Create file stream. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) + { + //Save the PDF document to file stream. + document.Save(outputFileStream); + } + + //Close the document. + document.Close(true); + } +} \ No newline at end of file diff --git a/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Setting-Section-Page-Numbers-With-Custom-Styles.csproj b/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Setting-Section-Page-Numbers-With-Custom-Styles.csproj new file mode 100644 index 00000000..16619ce3 --- /dev/null +++ b/Pages/Setting-Section-Page-Numbers-With-Custom-Styles/.NET/Setting-Section-Page-Numbers-With-Custom-Styles/Setting-Section-Page-Numbers-With-Custom-Styles.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Setting-Section-Page-Numbers-With-Custom-Styles + enable + enable + + + + + + +