Documents can be broken into sections using the SetSectionStart method of the Document class. Breaking a document into sections has several benefits:
- You can use the section numbering options of the Page Numbering Label Page Element.
- You can use section templates to apply Page Elements to all pages in a section.
- You can control the page labels that are displayed in a PDF viewer.
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 labels in Acrobat and is the default numbering style used by the page numbering label page element.
The following example shows how to break a document into sections.
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
Dim MyDocument
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
' Create a template object and add a page numbering label
Dim MyTemplate
Dim MyPageNumLabel
Set MyTemplate = MyDocument.SetTemplate
Set MyPageNumLabel = MyTemplate.AddPageNumberingLabel( "%%SP%% of %%ST%%", 0, 680, 512, 12 )
MyPageNumLabel.Font = DPDF_Font_Helvetica
MyPageNumLabel.FontSize = 12
MyPageNumLabel.Align = DPDF_Align_Center
' Begin the first section
Dim MySection
Set MySection = MyDocument.SetSectionStart
MySection.NumberingStyle = DPDF_NumberingStyle_RomanLowerCase
' Add two pages
MyDocument.AddPage() 'Page 1
MyDocument.AddPage() 'Page 2
' Begin the second section
Dim MySectionOne
Set MySectionOne = MyDocument.SetSectionStart
Dim MyTemplateOne
Dim MyPageNumberSection
Set MyTemplateOne = MySection.SetTemplate
Set MyPageNumberSection = MyTemplateOne.AddPageNumberingLabel( "%%SP%% of %%ST%%", 0, 60, 512, 12 )
MyPageNumberSection.Font = DPDF_Font_Helvetica
MyPageNumberSection.FontSize = 12
MyPageNumberSection.Align = DPDF_Align_Center
' Add three pages
MyDocument.AddPage() 'Page 3
MyDocument.AddPage() 'Page 4
MyDocument.AddPage() 'Page 5
' Begin the third section specifying a section prefix
Dim MySectionTwo
Set MySectionTwo = MyDocument.SetSectionStart
MySectionTwo.NumberingStyle = DPDF_NumberingStyle_RomanLowerCase
MySectionTwo.Prefix = "Appendix A - "
' Add two pages
MyDocument.AddPage() 'Page 6
MyDocument.AddPage() 'Page 7
' Draw the PDF
MyDocument.DrawToWeb True
Set MyDocument = Nothing
%>
| See Also |
Section Class | SetSectionStart Method | Programming with Generator for COM-ActiveX

