See Also

PageNumberingLabel Members  | ceTe.DynamicPDF.PageElements Namespace

Requirements

Namespace: ceTe.DynamicPDF.PageElements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: ceTe.DynamicPDF (in ceTe.DynamicPDF.dll)

Language

Visual Basic

C#

Show All

Represents a page numbering label page element.

For a list of all members of this type, see PageNumberingLabel members.

Object Model



Inheritance Hierarchy

System.Object
   ceTe.DynamicPDF.PageElement
      ceTe.DynamicPDF.PageElements.RotatingPageElement
         ceTe.DynamicPDF.PageElements.PageNumberingLabel

Syntax

[Visual Basic]
Public Class PageNumberingLabel    Inherits RotatingPageElement    Implements IAreaICoordinate 
[C#]
public class PageNumberingLabel : RotatingPageElement, IAreaICoordinate 

Remarks

This class can be used to add page and section numbering to a PDF document. A document can be broken up into sections using the Sections property of the Document class. The following tokens can be used within the text of a PageNumberingLabel. They will be replaced with the appropriate value when the PDF is output.
TokenDescription
CPCurrent page. The default numbering style is numeric. The current page can be offset using the is offset by the PageOffset property.
TPTotal pages. The default numbering style is numeric. The total pages can be offset using the is offset by the PageTotalOffset property.
SPSection page. The default numbering style is the numbering style used by the section. The total pages can be offset using the is offset by the PageTotalOffset property.
STSection Total. The default numbering style is the numbering style used by the section. The total pages can be offset using the is offset by the PageTotalOffset property.
PRPrefix. The sections prefix.

All tokens except the %%PR%% token can also contain a numbering style specifier. The numbering style specifier is placed in parenthesis after the token. If no numbering style specifier is given, then the current sections numbering specifier is used. If there are no document sections or the current section does not have a numbering specifier, numeric numbering is used.
Numbering StyleDescription
1Numeric. Arabic numbers are used: 1, 2, 3, etc. Example: "%%CP(1)%%"
iLower Case Roman Numerals. Lower case roman numerals are used: i, ii, iii, etc. Example: "%%CP(i)%%".
IUpper Case Roman Numerals. Upper case roman numerals are used: I, II, III, etc. Example: "%%CP(I)%%".
aLower Latin Letters. Lower case Latin letters are used: a, b, c, etc. After z, aa is used followed by bb, cc, etc. Example: "%%CP(a)%%".
AUpper Latin Letters. Upper case Latin letters are used: A, B, C, etc. After Z, AA is used followed by BB, CC, etc. Example: "%%CP(A)%%".
bLower Latin Letters. Lower case Latin letters are used: a, b, c, etc. After z, aa is used followed by ab, ac, etc. Example: "%%CP(b)%%".
BLower Latin Letters. Lower case Latin letters are used: A, B, C, etc. After Z, AA is used followed by AB, AC, etc. Example: "%%CP(B)%%".

There should be no spaces within a token, only the token and optional numbering style specifier. This token is invalid %%CP ( i )%% because of the extra spaces.

Here are some examples of valid tokens:

Example

The following example shows how to use page numbering in a document.

[Visual Basic] 

Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements

Module MyModule

    Sub Main()

        ' Create a PDF Document
        Dim MyDocument As Document = New Document

        ' Create a document template and add it to the document
        Dim documentTemplate As Template = New Template()
        MyDocument.Template = documentTemplate

        ' Place a page numbering label in the document template
        documentTemplate.Elements.Add( New PageNumberingLabel( _
            "%%PR%%%%SP%% of %%ST%%", 0, 680, 512, 12, Font.Helvetica, _
            12, TextAlign.Center ) )

        ' Begin the first section
        MyDocument.Sections.Begin( NumberingStyle.RomanLowerCase )

        ' Add three pages
        MyDocument.Pages.Add( new Page() ) 'Page 1
        MyDocument.Pages.Add( new Page() ) 'Page 2
        MyDocument.Pages.Add( new Page() ) 'Page 3

        ' Begin the second section
        MyDocument.Sections.Begin( NumberingStyle.Numeric )

        ' Add four pages
        MyDocument.Pages.Add( new Page() ) 'Page 4
        MyDocument.Pages.Add( new Page() ) 'page 5
        MyDocument.Pages.Add( new Page() ) 'page 6
        MyDocument.Pages.Add( new Page() ) 'page 7

        ' Begin the third section specifying a section prefix
        MyDocument.Sections.Begin( NumberingStyle.RomanLowerCase, _
            "Appendix A - " )

        ' Add two pages
        MyDocument.Pages.Add( new Page() ) 'page 8
        MyDocument.Pages.Add( new Page() ) 'page 9

        ' Save the PDF
        MyDocument.Draw("C:\MyDocument.pdf")

    End Sub
End Module

[C#] 

using System; 
using ceTe.DynamicPDF; 
using ceTe.DynamicPDF.PageElements; 
 
class MyClass 

    static void Main() 
    { 
        // Create a PDF Document 
        Document document = new Document(); 
 
        // Create a document template and add it to the document 
        Template documentTemplate = new Template(); 
        document.Template = documentTemplate; 
 
        // Place a page numbering label in the document template 
        documentTemplate.Elements.Add( new PageNumberingLabel(  
            "%%PR%%%%SP%% of %%ST%%", 0, 680, 512, 12, Font.Helvetica,  
            12, TextAlign.Center ) ); 
 
        // Begin the first section 
        document.Sections.Begin( NumberingStyle.RomanLowerCase ); 
 
        // Add three pages 
        document.Pages.Add( new Page() ); //Page 1 
        document.Pages.Add( new Page() ); //Page 2 
        document.Pages.Add( new Page() ); //Page 3 
 
        // Begin the second section 
        document.Sections.Begin( NumberingStyle.Numeric ); 
 
        // Add four pages 
        document.Pages.Add( new Page() ); //Page 4 
        document.Pages.Add( new Page() ); //page 5 
        document.Pages.Add( new Page() ); //page 6 
        document.Pages.Add( new Page() ); //page 7 
 
        // Begin the third section specifying a section prefix 
        document.Sections.Begin( NumberingStyle.RomanLowerCase,  
            "Appendix A - " ); 
 
        // Add two pages 
        document.Pages.Add( new Page() ); //page 8 
        document.Pages.Add( new Page() ); //page 9 
 
        // Save the PDF 
        document.Draw( @"C:\MyDocument.pdf" ); 
    } 
}

Licensing

This class is a DynamicPDF Generator Community Edition feature.

Requirements

Namespace: ceTe.DynamicPDF.PageElements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: ceTe.DynamicPDF (in ceTe.DynamicPDF.dll)

See Also

PageNumberingLabel Members  | ceTe.DynamicPDF.PageElements Namespace

 

 


© Copyright 2007, ceTe Software