Document Sectioning

Break documents into sections using the Sections property of the Document class. Breaking a document into sections has several benefits.

Sections

A Document has a Sections property. The Sections property is a SectionsList containing the sections. Each section can have a numbering style specified.

See the NumberingStyle enumeration for a list of supported numbering styles.

If no numbering style is specified, numeric numbering is used. The section's numbering style affects the page's label in Acrobat and is the default numbering style used by the page numbering label page element.

Begin

Specify a section by calling the SectionList collection's Begin method. This method is overloaded to accept a numbering style, optional text, and a template that can be applied to the pages specific to that section.

Begin()
Begin(NumberingStyle)
Begin(NumberingStyle, String)
Begin(NumberingStyle, String, Template)
Begin(NumberingStyle, Template)
Begin(String)
Begin(String, Template)
Begin(Template)

The Begin method adds the page numbering style displayed in the PDF reader not on the page.

Adobe Menu Bar

The following example shows how to break a document into sections.

Document myDoc = new();
myDoc.Pages.Add(new Page());
Template template = new Template();
template.Elements.Add(new PageNumberingLabel("%%SP%% of %%ST%%", 0, 680, 512, 12, Font.Helvetica, 12, TextAlign.Center));

myDoc.Template = template;
myDoc.Sections.Begin(NumberingStyle.RomanLowerCase);
myDoc.Pages.Add(new Page()); //Page 1
myDoc.Pages.Add(new Page()); //Page 2

myDoc.Sections.Begin(NumberingStyle.Numeric, template);
myDoc.Pages.Add(new Page()); //Page 3
myDoc.Pages.Add(new Page()); //page 4
myDoc.Pages.Add(new Page()); //page 5

myDoc.Sections.Begin(NumberingStyle.RomanLowerCase, "Appendix A - ");
myDoc.Pages.Add(new Page()); //page 6
myDoc.Pages.Add(new Page()); //page 7

myDoc.Draw(outputPath);    
Dim myDoc As New Document()
myDoc.Pages.Add(New Page())
Dim template As New Template()
template.Elements.Add(New PageNumberingLabel("%%SP%% of %%ST%%", 0, 680, 512, 12, Font.Helvetica, 12, TextAlign.Center))

myDoc.Template = template

myDoc.Sections.Begin(NumberingStyle.RomanLowerCase)
myDoc.Pages.Add(New Page()) 'Page 1
myDoc.Pages.Add(New Page()) 'Page 2

myDoc.Sections.Begin(NumberingStyle.Numeric, template)
myDoc.Pages.Add(New Page()) 'Page 3
myDoc.Pages.Add(New Page()) 'Page 4
myDoc.Pages.Add(New Page()) 'Page 5

myDoc.Sections.Begin(NumberingStyle.RomanLowerCase, "Appendix A - ")
myDoc.Pages.Add(New Page()) 'Page 6
myDoc.Pages.Add(New Page()) 'Page 7

myDoc.Draw(outputPath))

Document Sectioning Figure 1. A document split into sections.

Refer to the SectionsList and Sections property API documentation for complete examples.

In this topic