Add Section to PDF (.NET Core/Framework)
Adding Section to PDF using DynamicPDF Core Suite is straightforward. 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.
- Can use the section numbering options of the Page Numbering Label Page Element.
- Can use section templates to apply Page Elements to all pages in a section.
- Can control the page labels that are displayed in a PDF viewer.
Steps for Adding Sections in a PDF Document
- Create a
Document
object. - Create a
Template
object and add a page numbering label. - Begin the Section on the document and add as many pages.
- Create as many Sections as required and add pages to those 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");
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 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
More information can be found on the DynamicPDF Core Suite webpage.
Available on Other Platforms
DynamicPDF Core Suite is 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