DynamicPDF by ceTe Software

com.cete.dynamicpdf.pageelements
Class PageNumberingLabel

java.lang.Object
  extended by com.cete.dynamicpdf.PageElement
      extended by com.cete.dynamicpdf.pageelements.TaggablePageElement
          extended by com.cete.dynamicpdf.pageelements.RotatingPageElement
              extended by com.cete.dynamicpdf.pageelements.PageNumberingLabel
All Implemented Interfaces:
IArea, ICoordinate

public class PageNumberingLabel
extends RotatingPageElement
implements IArea, ICoordinate

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.

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

Licensing:
This class is a DynamicPDF Generator Community Edition feature.

View Example


Constructor Summary
PageNumberingLabel(java.lang.String text, float x, float y, float width, float height)
          Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(java.lang.String text, float x, float y, float width, float height, Font font)
          Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(java.lang.String text, float x, float y, float width, float height, Font font, float fontSize)
          Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(java.lang.String text, float x, float y, float width, float height, Font font, float fontSize, Color textColor)
          Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(java.lang.String text, float x, float y, float width, float height, Font font, float fontSize, TextAlign align)
          Initializes a new instance of the PageNumberingLabel class.
PageNumberingLabel(java.lang.String text, float x, float y, float width, float height, Font font, float fontSize, TextAlign align, Color textColor)
          Initializes a new instance of the PageNumberingLabel class.
 
Method Summary
protected  void drawRotated(PageWriter writer)
          Draws the label to the given PageWriter object.
 TextAlign getAlign()
          Gets the TextAlign enumeration that specifies the text alignment of the label.
 Font getFont()
          Gets the Font object to use for the text of the label.
 float getFontSize()
          Gets the font size for the text of the label.
 int getNumberingLength()
          Gets the length of the page numbering label.
 char getNumberingPaddingCharacter()
          Gets the padding character of the page numbering label.
 int getPageOffset()
          Gets the page offset for page numbering.
 int getPageTotalOffset()
          Gets the page total offset for page numbering.
 java.lang.String getText()
          Gets the text of the label.
 Color getTextColor()
          Gets the Color object to use for the text of the label.
 boolean getUnderline()
          Gets a value indicating if the label is underlined.
 VAlign getVAlign()
          Gets the VAlign enumeration that specifies the vertical text alignment of the label.
 float getWidth()
          Gets the width of the label.
 void setAlign(TextAlign align)
          Sets the TextAlign enumeration that specifies the text alignment of the label.
 void setFont(Font font)
          Sets the Font object to use for the text of the label.
 void setFontSize(float fontSize)
          Sets the font size for the text of the label.
 void setNumberingLength(int numberingLength)
          Sets the length of the page numbering label.
 void setNumberingPaddingCharacter(char paddingChar)
          Sets the padding character of the page numbering label.
 void setPageOffset(int pageOffset)
          Sets the page offset for page numbering.
 void setPageTotalOffset(int pageTotalOffset)
          Sets the page total offset for page numbering.
 void setText(java.lang.String text)
          Sets the text of the label.
 void setTextColor(Color textColor)
          Sets the Color object to use for the text of the label.
 void setUnderline(boolean underline)
          Sets a value indicating if the label is underlined.
 void setVAlign(VAlign vAlign)
          Sets the VAlign enumeration that specifies the vertical text alignment of the label.
 void setWidth(float width)
          Sets the width of the label.
 
Methods inherited from class com.cete.dynamicpdf.pageelements.RotatingPageElement
draw, getAngle, getHeight, getX, getY, setAngle, setHeight, setX, setY
 
Methods inherited from class com.cete.dynamicpdf.pageelements.TaggablePageElement
getTag, getTagOrder, setTag, setTagOrder
 
Methods inherited from class com.cete.dynamicpdf.PageElement
getRequiredLicenseLevel, getStrID, setRequiredLicenseLevel, setStrID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cete.dynamicpdf.pageelements.IArea
getHeight, setHeight
 
Methods inherited from interface com.cete.dynamicpdf.pageelements.ICoordinate
getX, getY, setX, setY
 

Constructor Detail

PageNumberingLabel

public PageNumberingLabel(java.lang.String text,
                          float x,
                          float y,
                          float width,
                          float height)
Initializes a new instance of the PageNumberingLabel class.

Parameters:
text - Text to display in the label.
x - X coordinate of the label.
y - Y coordinate of the label.
width - Width of the label.
height - Height of the label.

PageNumberingLabel

public PageNumberingLabel(java.lang.String text,
                          float x,
                          float y,
                          float width,
                          float height,
                          Font font)
Initializes a new instance of the PageNumberingLabel class.

Parameters:
text - Text to display in the label.
x - X coordinate of the label.
y - Y coordinate of the label.
width - Width of the label.
height - Height of the label.
font - Font for the text of the label.
See Also:
Font

PageNumberingLabel

public PageNumberingLabel(java.lang.String text,
                          float x,
                          float y,
                          float width,
                          float height,
                          Font font,
                          float fontSize)
Initializes a new instance of the PageNumberingLabel class.

Parameters:
text - Text to display in the label.
x - X coordinate of the label.
y - Y coordinate of the label.
width - Width of the label.
height - Height of the label.
font - Font for the text of the label.
fontSize - Font size of the text of the label.
See Also:
Font

PageNumberingLabel

public PageNumberingLabel(java.lang.String text,
                          float x,
                          float y,
                          float width,
                          float height,
                          Font font,
                          float fontSize,
                          TextAlign align)
Initializes a new instance of the PageNumberingLabel class.

Parameters:
text - Text to display in the label.
x - X coordinate of the label.
y - Y coordinate of the label.
width - Width of the label.
height - Height of the label.
font - Font for the text of the label.
fontSize - Font size of the text of the label.
align - Alignment of the text of the label.
See Also:
Font, TextAlign

PageNumberingLabel

public PageNumberingLabel(java.lang.String text,
                          float x,
                          float y,
                          float width,
                          float height,
                          Font font,
                          float fontSize,
                          Color textColor)
Initializes a new instance of the PageNumberingLabel class.

Parameters:
text - Text to display in the label.
x - X coordinate of the label.
y - Y coordinate of the label.
width - Width of the label.
height - Height of the label.
font - Font for the text of the label.
fontSize - Font size of the text of the label.
textColor - Color of the text of the label.
See Also:
Font, Color

PageNumberingLabel

public PageNumberingLabel(java.lang.String text,
                          float x,
                          float y,
                          float width,
                          float height,
                          Font font,
                          float fontSize,
                          TextAlign align,
                          Color textColor)
Initializes a new instance of the PageNumberingLabel class.

Parameters:
text - Text to display in the label.
x - X coordinate of the label.
y - Y coordinate of the label.
width - Width of the label.
height - Height of the label.
font - Font for the text of the label.
fontSize - Font size of the text of the label.
align - Alignment of the text of the label.
textColor - Color of the text of the label.
See Also:
Font, TextAlign, Color
Method Detail

setAlign

public void setAlign(TextAlign align)
Sets the TextAlign enumeration that specifies the text alignment of the label.

Parameters:
align - TextAlign enumeration that specifies the text alignment of the label.
See Also:
TextAlign

getAlign

public TextAlign getAlign()
Gets the TextAlign enumeration that specifies the text alignment of the label.

Returns:
TextAlign enumeration that specifies the text alignment of the label.
See Also:
TextAlign

setVAlign

public void setVAlign(VAlign vAlign)
Sets the VAlign enumeration that specifies the vertical text alignment of the label.

Parameters:
vAlign - VAlign enumeration that specifies the vertical text alignment of the label.
See Also:
VAlign

getVAlign

public VAlign getVAlign()
Gets the VAlign enumeration that specifies the vertical text alignment of the label.

Returns:
VAlign enumeration that specifies the vertical text alignment of the label.
See Also:
VAlign

setUnderline

public void setUnderline(boolean underline)
Sets a value indicating if the label is underlined.

Parameters:
underline - value indicating if the label is underlined.

getUnderline

public boolean getUnderline()
Gets a value indicating if the label is underlined.

Returns:
value indicating if the label is underlined.

setText

public void setText(java.lang.String text)
Sets the text of the label.

Parameters:
text - the text of the label.

getText

public java.lang.String getText()
Gets the text of the label.

Returns:
the text of the label.

setTextColor

public void setTextColor(Color textColor)
Sets the Color object to use for the text of the label.

Parameters:
textColor - Color object to use for the text of the label.
See Also:
Color

getTextColor

public Color getTextColor()
Gets the Color object to use for the text of the label.

Returns:
Color object used for the text of the label.
See Also:
Color

setFont

public void setFont(Font font)
Sets the Font object to use for the text of the label.

Parameters:
font - Font object to use for the text of the label.
See Also:
Font

getFont

public Font getFont()
Gets the Font object to use for the text of the label.

Returns:
Font object used for the text of the label.
See Also:
Font

setFontSize

public void setFontSize(float fontSize)
Sets the font size for the text of the label.

Parameters:
fontSize - the font size for the text of the label.

getFontSize

public float getFontSize()
Gets the font size for the text of the label.

Returns:
font size for the text of the label.

setWidth

public void setWidth(float width)
Sets the width of the label.

Specified by:
setWidth in interface IArea
Parameters:
width - the width of the label.

getWidth

public float getWidth()
Gets the width of the label.

Specified by:
getWidth in interface IArea
Returns:
width of the label.

setPageTotalOffset

public void setPageTotalOffset(int pageTotalOffset)
Sets the page total offset for page numbering.

Parameters:
pageTotalOffset - the page total offset for page numbering.

getPageTotalOffset

public int getPageTotalOffset()
Gets the page total offset for page numbering.

Returns:
page total offset for page numbering.

setPageOffset

public void setPageOffset(int pageOffset)
Sets the page offset for page numbering.

Parameters:
pageOffset - page offset for page numbering.

getPageOffset

public int getPageOffset()
Gets the page offset for page numbering.

Returns:
page offset for page numbering.

getNumberingLength

public int getNumberingLength()
Gets the length of the page numbering label.

Returns:
length of the page numbering label.

setNumberingLength

public void setNumberingLength(int numberingLength)
Sets the length of the page numbering label.

Parameters:
numberingLength - length of the page numbering label.

getNumberingPaddingCharacter

public char getNumberingPaddingCharacter()
Gets the padding character of the page numbering label.

Returns:
padding character of the page numbering label.

setNumberingPaddingCharacter

public void setNumberingPaddingCharacter(char paddingChar)
Sets the padding character of the page numbering label.

Parameters:
paddingChar - padding character of the page numbering label.

drawRotated

protected void drawRotated(PageWriter writer)
Draws the label to the given PageWriter object.

Specified by:
drawRotated in class RotatingPageElement
Parameters:
writer - PageWriter object to receive the label's output.
See Also:
PageWriter

DynamicPDF by ceTe Software

API Reference for DynamicPDF v10.07 for Java generated on Aug 12, 2020
© Copyright 2020, ceTe Software