Examples

Add Section to PDF (.NET Core/Framework)

Adding Section to PDF using DynamicPDF Generator is simple and easy. Documents can be broken into Sections has following benefits

How to add Section to PDF in C#

Below are the steps and sample code to add an Section to PDF document using the Generator product.

  1. Can use the section numbering options of the Page Numbering Label Page Element.
  2. Can use section templates to apply Page Elements to all pages in a section.
  3. Can control the page labels that are displayed in a PDF viewer.

Steps for adding Sections in a PDF Document

  1. Create a Document object.
  2. Create a Template object and add a page numbering label.
  3. Begin the Section on the document and add as many pages.
  4. Create as many Sections as required and add pages to those 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(@"C:\Output.pdf");        

Over 75 Page Elements

DynamicPDF Generator contains over 75 page elements so you can add rich content to the PDFs you create:

  • Images
  • Text Objects (TextArea and Label)
  • HTML
  • Barcodes (47 types)
  • Form Fields
  • Charts

Getting Started

NuGet Package

DynamicPDF Generator is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite package includes Generator, Merger and ReportWriter.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Generator Information

More information can be found here:

Available in other platforms

DynamicPDF Generator is available for the following 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 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

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