PageNumberStamp
Overview
PageNumberStamp is a class in Aspose.PDF FOSS for Java.
Inherits from: TextStamp.
Represents a page number stamp that renders the current page number and total page count on each page of the PDF document.
This class provides 53 methods for working with PageNumberStamp objects in Java programs.
Available methods include: PageNumberStamp, TextStamp, formatPageNumber, getBottomMargin, getFormat, getHeight, getHorizontalAlignment, getLeftMargin, getOpacity, getRightMargin, getRotate, getRotateAngle, and 40 additional methods.
All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package.
Properties: background, bottomMargin, format, height, horizontalAlignment, leftMargin, and 18 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
format | String | Read | Returns the format string for the page number. |
startingNumber | int | Read | Returns the starting page number. |
value | String | Read | Returns the text content of this stamp. |
textState | TextState | Read | Returns the text state for this stamp, creating it lazily if needed. |
wordWrapMode | TextFormattingOptions.WordWrapMode | Read | Returns the word wrap mode for this stamp’s text. |
textAlignment | HorizontalAlignment | Read | Returns the text alignment within the stamp area. |
xIndent | double | Read | Returns the horizontal position (X indent) of the stamp in points. |
yIndent | double | Read | Returns the vertical position (Y indent) of the stamp in points. |
width | double | Read | Returns the width of the stamp area in points. |
height | double | Read | Returns the height of the stamp area in points. |
background | boolean | Read | Returns whether this stamp is rendered behind the page content. |
rotate | Rotation | Read | Returns the rotation enum for this stamp. |
rotateAngle | double | Read | Returns the rotation angle of the stamp in degrees. |
opacity | double | Read | Returns the opacity (transparency) of the stamp. |
horizontalAlignment | HorizontalAlignment | Read | Returns the horizontal alignment of the stamp on the page. |
verticalAlignment | VerticalAlignment | Read | Returns the vertical alignment of the stamp on the page. |
leftMargin | double | Read | Returns the left margin of the stamp in points. |
rightMargin | double | Read | Returns the right margin of the stamp in points. |
topMargin | double | Read | Returns the top margin of the stamp in points. |
bottomMargin | double | Read | Returns the bottom margin of the stamp in points. |
stampId | int | Read | Returns the stamp identifier. |
zoom | double | Read | Returns the zoom (scale) factor for the stamp. |
zoomX | double | Read | Returns the horizontal zoom (scale) factor for the stamp. |
zoomY | double | Read | Returns the vertical zoom (scale) factor for the stamp. |
Methods
| Signature | Description |
|---|---|
PageNumberStamp() | Creates a new PageNumberStamp with the default format “Page # of $P”. |
PageNumberStamp(format: String) | Creates a new PageNumberStamp with the specified format string. |
getFormat() → String | Returns the format string for the page number. |
setFormat(format: String) | Sets the format string for the page number. |
getStartingNumber() → int | Returns the starting page number. |
setStartingNumber(startingNumber: int) | Sets the starting page number. |
formatPageNumber(pageIndex: int, totalPages: int) → String | Formats the page number text for the given page index and total page count. |
TextStamp(value: String) | Creates a new TextStamp with the given text value. |
getValue() → String | Returns the text content of this stamp. |
setValue(value: String) | Sets the text content of this stamp. |
getTextState() → TextState | Returns the text state for this stamp, creating it lazily if needed. |
setTextState(textState: TextState) | Sets the text state for this stamp. |
getWordWrapMode() → TextFormattingOptions.WordWrapMode | Returns the word wrap mode for this stamp’s text. |
setWordWrapMode(wordWrapMode: TextFormattingOptions.WordWrapMode) | Sets the word wrap mode for this stamp’s text. |
getTextAlignment() → HorizontalAlignment | Returns the text alignment within the stamp area. |
setTextAlignment(textAlignment: HorizontalAlignment) | Sets the text alignment within the stamp area. |
put(page: Page) | Applies this text stamp to the given page. |
getXIndent() → double | Returns the horizontal position (X indent) of the stamp in points. |
setXIndent(xIndent: double) | Sets the horizontal position (X indent) of the stamp in points. |
getYIndent() → double | Returns the vertical position (Y indent) of the stamp in points. |
setYIndent(yIndent: double) | Sets the vertical position (Y indent) of the stamp in points. |
getWidth() → double | Returns the width of the stamp area in points. |
setWidth(width: double) | Sets the width of the stamp area in points. |
getHeight() → double | Returns the height of the stamp area in points. |
setHeight(height: double) | Sets the height of the stamp area in points. |
isBackground() → boolean | Returns whether this stamp is rendered behind the page content. |
setBackground(background: boolean) | Sets whether this stamp is rendered behind the page content. |
getRotate() → Rotation | Returns the rotation enum for this stamp. |
setRotate(rotate: Rotation) | Sets the rotation using the {@link Rotation} enum. |
getRotateAngle() → double | Returns the rotation angle of the stamp in degrees. |
setRotateAngle(rotateAngle: double) | Sets the rotation angle of the stamp in degrees. |
getOpacity() → double | Returns the opacity (transparency) of the stamp. |
setOpacity(opacity: double) | Sets the opacity (transparency) of the stamp. |
getHorizontalAlignment() → HorizontalAlignment | Returns the horizontal alignment of the stamp on the page. |
setHorizontalAlignment(horizontalAlignment: HorizontalAlignment) | Sets the horizontal alignment of the stamp on the page. |
getVerticalAlignment() → VerticalAlignment | Returns the vertical alignment of the stamp on the page. |
setVerticalAlignment(verticalAlignment: VerticalAlignment) | Sets the vertical alignment of the stamp on the page. |
getLeftMargin() → double | Returns the left margin of the stamp in points. |
setLeftMargin(leftMargin: double) | Sets the left margin of the stamp in points. |
getRightMargin() → double | Returns the right margin of the stamp in points. |
setRightMargin(rightMargin: double) | Sets the right margin of the stamp in points. |
getTopMargin() → double | Returns the top margin of the stamp in points. |
setTopMargin(topMargin: double) | Sets the top margin of the stamp in points. |
getBottomMargin() → double | Returns the bottom margin of the stamp in points. |
setBottomMargin(bottomMargin: double) | Sets the bottom margin of the stamp in points. |
getStampId() → int | Returns the stamp identifier. |
setStampId(stampId: int) | Sets the stamp identifier. |
getZoom() → double | Returns the zoom (scale) factor for the stamp. |
setZoom(zoom: double) | Sets the zoom (scale) factor for the stamp. |
getZoomX() → double | Returns the horizontal zoom (scale) factor for the stamp. |
setZoomX(zoomX: double) | Sets the horizontal zoom (scale) factor for the stamp. |
getZoomY() → double | Returns the vertical zoom (scale) factor for the stamp. |
setZoomY(zoomY: double) | Sets the vertical zoom (scale) factor for the stamp. |