Examples

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

  1. Create a Document object.
  2. Create a Template object and add a PageNumberingLabel.
  3. Begin a document section and add desired number of pages.
  4. Create as many sections as required and add pages to the added sections.
  5. 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.

Clone or View Example Project on GitHub

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.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

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 and Label)
  • 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.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!