PageNumberingLabel

Represents a page numbering label page element.

public class PageNumberingLabel : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class PageNumberingLabel
    Inherits RotatingPageElement
    Implements IArea, ICoordinate, ISerializable

Inheritance: ObjectPageElementTaggablePageElementRotatingPageElementPageNumberingLabel

Implements: IArea, ICoordinate, ISerializable

Licensing Info

This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:

Examples

The following example shows how to use page numbering in a document.
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
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
    public static void CreatePDF(string outputPath)
    {
        // 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( outputPath );
    }
}

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.

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.

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: /%/%SP/%/% /%/%SP(I)/%/% /%/%PR/%/% /%/%ST(B)/%/%

Constructors

PageNumberingLabel(String, Single, Single, Single, Single)Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(String, Single, Single, Single, Single, Font)Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(String, Single, Single, Single, Single, Font, Single)Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(String, Single, Single, Single, Single, Font, Single, Color)Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(String, Single, Single, Single, Single, Font, Single, TextAlign)Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(String, Single, Single, Single, Single, Font, Single, TextAlign, Color, [Optional] Boolean)Initializes a new instance of the PageNumberingLabel class.

Properties

AlignGets or sets the Align enumeration that specifies the text alignment of the label.
AngleGets or sets the heights of the angle element.
(Inherited from RotatingPageElement)
FontGets or sets the Font object to use for the text of the label.
FontSizeGets or sets the font size for the text of the label.
HeightGets or sets the heights of the page element.
(Inherited from RotatingPageElement)
IDGets or sets the ID of the page element.
(Inherited from PageElement)
IgnoreMarginsGets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property.
(Inherited from PageElement)
NumberingLengthGets or sets the length of the page numbering label.
NumberingPaddingCharacterGets or sets the padding character of the page numbering label.
PageOffsetGets or sets the page offset for page numbering.
PageTotalOffsetGets or sets the page total offset for page numbering.
RelativeToGets and sets placement of the page element on the page.
(Inherited from PageElement)
RightToLeftGets or sets a value indicating if text should be displayed right to left.
TagGets or sets the tag of the taggable element.
(Inherited from TaggablePageElement)
TagOrderGets or sets the tag order of the taggable element.
(Inherited from TaggablePageElement)
TextGets or sets the text of the label.
TextColorGets or sets the Color object to use for the text of the label.
UnderlineGets or sets a value indicating if the label is underlined.
VAlignGets or sets the VAlign enumeration that specifies the vertical text alignment of the label.
WidthGets or sets the width or the label.
XGets or sets the X coordinate of the page element.
(Inherited from RotatingPageElement)
YGets or sets the Y coordinate of the page element.
(Inherited from RotatingPageElement)

Methods

Draw(PageWriter)Draws the page element to the given PageWriter object.
(Inherited from RotatingPageElement)
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF.PageElements

In this topic