Add Section to PDF
Adding Section to a PDF using DynamicPDF Core Suite is straightforward.
How to Add Section to PDF in C#
The following example illustrates adding an section to a PDF document.
Steps for Adding Sections in a PDF Document
- Create a
Document
object. - Create a
Template
object and add aPageNumberingLabel
. - Begin a document section and add desired number of pages.
- Create as many sections as required and add pages to the added sections.
- 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
Clone or view the example project at GitHub. This example code is contained in the Examples/SectionsExample.cs file.
Getting Started
NuGet Package
DynamicPDF Core Suite is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET
package. The easiest way to install the package is through the Visual Studio Package Manager. You can also download the package directly from NuGet.
DynamicPDF Core Suite Information
DynamicPDF Core Suite contains over 75 page elements you can add to PDFs to create rich content, including:
- Images
- Text Objects (
TextArea
andLabel
) - HTML
- Barcodes (47 types)
- Form Fields
- Charts
Refer to the DynamicPDF Core Suite website for more information.
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.
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX