Package com.dynamicpdf.api.elements
Class PageNumberingElement
java.lang.Object
com.dynamicpdf.api.elements.Element
com.dynamicpdf.api.elements.PageNumberingElement
Represents a page numbering label page element.
All tokens except the %%PR%% token can also contain a numbering style specifier. The numbering style specifier is placed in parenthesis after the token.
This class can be used to add page numbering to a PDF document. 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.
Token | Description |
---|---|
CP | Current page. The default numbering style is numeric. |
TP | Total pages. The default numbering style is numeric. |
SP | Section page. |
ST | Section Total. |
PR | 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 Style | Description |
---|---|
1 | Numeric. Arabic numbers are used: 1, 2, 3, etc. Example: "%%CP(1)%%" |
i | Lower Case Roman Numerals. Lower case roman numerals are used: i, ii, iii, etc. Example: "%%CP(i)%%". |
I | Upper Case Roman Numerals. Upper case roman numerals are used: I, II, III, etc. Example: "%%CP(I)%%". |
a | Lower 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)%%". |
A | Upper 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)%%". |
b | Lower 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)%%". |
B | Lower 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)%%
-
Constructor Summary
ConstructorDescriptionPageNumberingElement(String text, ElementPlacement placement)
Initializes a new instance of thePageNumberingElement
class.PageNumberingElement(String text, ElementPlacement placement, float xOffset, float yOffset)
Initializes a new instance of thePageNumberingElement
class. -
Method Summary
Modifier and TypeMethodDescriptiongetColor()
Gets theColor
object to use for the text of the labelgetFont()
Gets theFont
object to use for the text of the label.float
Gets the font size for the text of the label.getText()
Gets the text to display in the label.void
Sets theColor
object to use for the text of the labelvoid
Sets theFont
object to use for the text of the label.void
setFontSize(float value)
Sets the font size for the text of the label.void
Sets the text to display in the label.Methods inherited from class com.dynamicpdf.api.elements.Element
getEvenPages, getOddPages, getPlacement, getXOffset, getYOffset, setEvenPages, setOddPages, setPlacement, setXOffset, setYOffset
-
Constructor Details
-
PageNumberingElement
Initializes a new instance of thePageNumberingElement
class.- Parameters:
text
- Text to display in the label.placement
- The placement of the page numbering element on the page.xOffset
- X coordinate of the label.yOffset
- Y coordinate of the label.
-
PageNumberingElement
Initializes a new instance of thePageNumberingElement
class.- Parameters:
text
- Text to display in the label.placement
- The placement of the page numbering element on the page.
-
-
Method Details
-
getResource
- Overrides:
getResource
in classElement
-
getTextFont
- Overrides:
getTextFont
in classElement
-
getColor
Gets theColor
object to use for the text of the label- Returns:
- The
Color
object to use for the text of the label
-
setColor
Sets theColor
object to use for the text of the label- Parameters:
value
- TheColor
object to use for the text of the label
-
getFont
Gets theFont
object to use for the text of the label.- Returns:
- The
Font
object to use for the text of the label.
-
setFont
Sets theFont
object to use for the text of the label.- Parameters:
value
- TheFont
object to use for the text of the label.
-
getFontSize
public float getFontSize()Gets the font size for the text of the label.- Returns:
- The font size for the text of the label.
-
setFontSize
public void setFontSize(float value)Sets the font size for the text of the label.- Parameters:
value
- The font size for the text of the label.
-
getText
Gets the text to display in the label.- Returns:
- The text to display in the label.
-
setText
Sets the text to display in the label.- Parameters:
value
- The text to display in the label.
-