Add Sections to a PDF
Adding sections to a PDF using DynamicPDF Core Suite for .NET makes creating better organized PDF documents a breeze. The following C# example shows you how.
Watch the Video
How to Add Section to PDF
The following steps and C# code example illustrates adding a section to a PDF document.
Steps for Adding Sections in a PDF Document
- Create a
Document
object. - Create a
Template
object and add a PageNumberingLabel. - Begin a document section using Sections property with the
Document
instance's SectionList.Begin method. - Add desired number of pages.
- Create as many sections as required and add pages to the added sections.
- Add the
Document
object'sDraw
method to draw and save the PDF document.
Sample Code - C#
Document document = new Document();
Template template = new Template();
template.Elements.Add( new PageNumberingLabel( "%%SP%% of %%ST%%", 0, 680, 512, 12, Font.Helvetica, 12, TextAlign.Center ) );
document.Sections.Begin( NumberingStyle.RomanLowerCase );
document.Pages.Add( new Page() ); //Page 1
document.Pages.Add( new Page() ); //Page 2
document.Sections.Begin( NumberingStyle.Numeric, template );
document.Pages.Add( new Page() ); //Page 3
document.Pages.Add( new Page() ); //page 4
document.Pages.Add( new Page() ); //page 5
document.Sections.Begin( NumberingStyle.RomanLowerCase, "Appendix A - " );
document.Pages.Add( new Page() ); //page 6
document.Pages.Add( new Page() ); //page 7
document.Draw("Output.pdf");
GitHub Project
An example project is available on GitHub (examples.dynamicpdf-core-suite-dotnet-core). Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. This specific example discussed on this page are all contained in following classes on GitHub
- C# - SectionsExample.cs
- VB.NET - SectionsExample.vb
Getting Started
Get started easily by installing DynamicPDF Core Suite for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing the product.
NuGet Package
The easiest way to install DynamicPDF Core Suite is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.
DynamicPDF Core Suite for .NET Information
DynamicPDF Core Suite for .NET combines creating, merging, and visual report creation into one powerful product for creating PDF documents. It is ideal for anyone who needs to generate PDF documents or reports or work with existing PDFs in their applications. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Core Suite for .NET today!
More Information on Sections
- Refer to the Document Sectioning documentation topic, or
- Chapter 3, Templates and Sections, in the book DynamicPDF Core Suite for .NET by Example available on GitHub.
Available on Other Platforms
DynamicPDF Core Suite is also available for the Java and COM/ActiveX platforms. Refer to the respective product pages for more details.
- DynamicPDF Generator
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX
- DynamicPDF Merger
- Java - DynamicPDF Merger for Java
- COM/ActiveX - DynamicPDF Merger for COM/ActiveX