Class PdfFooter
java.lang.Object
cloud.opencode.base.pdf.document.PdfFooter
PDF Footer - Page footer configuration for PDF documents
PDF 页脚 - PDF 文档的页脚配置
Configures the footer area that appears at the bottom of each page in a PDF document. Supports left, center, and right aligned text with page number placeholders.
配置 PDF 文档中每页底部显示的页脚区域。 支持左、中、右对齐文本,以及页码占位符。
Features | 主要功能:
- Three-column layout (left, center, right) - 三列布局(左、中、右)
- Page number placeholders: {page} and {total} - 页码占位符: {page} 和 {total}
- Optional separator line above footer - 可选的页脚分隔线
- Configurable font, size, and color - 可配置字体、字号和颜色
Usage Examples | 使用示例:
// Simple centered footer with page numbers
PdfFooter footer = PdfFooter.of("Page {page} of {total}");
// Custom footer
PdfFooter footer = PdfFooter.builder()
.left("Confidential")
.center("Page {page}/{total}")
.right("2026-04-04")
.fontSize(8f)
.showLine(true);
Security | 安全性:
- Thread-safe: No — mutable builder pattern - 线程安全: 否 — 可变构建器模式
- Null-safe: text fields may be null (not rendered) - 空值安全: 文本字段可为 null(不渲染)
- Since:
- JDK 25, opencode-base-pdf V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic PdfFooterbuilder()Creates an empty footer builder 创建空的页脚构建器Sets center-aligned text 设置居中文本Sets text color 设置文本颜色Sets font 设置字体fontSize(float size) Sets font size 设置字号Gets center-aligned text 获取居中文本getColor()Gets text color 获取文本颜色getFont()Gets font 获取字体floatGets font size 获取字号getLeft()Gets left-aligned text 获取左对齐文本getRight()Gets right-aligned text 获取右对齐文本booleanChecks if separator line is shown 检查是否显示分隔线Sets left-aligned text 设置左对齐文本static PdfFooterCreates a footer with centered text 创建居中文本的页脚Sets right-aligned text 设置右对齐文本showLine(boolean show) Sets whether to show separator line above footer 设置是否显示页脚上方分隔线toString()
-
Method Details
-
of
-
builder
Creates an empty footer builder 创建空的页脚构建器- Returns:
- PdfFooter builder | PdfFooter 构建器
-
left
-
center
-
right
-
fontSize
Sets font size 设置字号- Parameters:
size- font size in points | 字号(磅)- Returns:
- this footer | 当前页脚
- Throws:
IllegalArgumentException- if size is not positive | 当字号不为正数时
-
color
Sets text color 设置文本颜色- Parameters:
color- text color | 文本颜色- Returns:
- this footer | 当前页脚
- Throws:
NullPointerException- if color is null | 当 color 为 null 时
-
font
-
showLine
Sets whether to show separator line above footer 设置是否显示页脚上方分隔线- Parameters:
show- true to show line | true 表示显示分隔线- Returns:
- this footer | 当前页脚
-
getLeft
-
getCenter
-
getRight
-
getFontSize
public float getFontSize()Gets font size 获取字号- Returns:
- font size in points | 字号
-
getColor
-
getFont
-
isShowLine
public boolean isShowLine()Checks if separator line is shown 检查是否显示分隔线- Returns:
- true if line is shown | 如果显示分隔线返回 true
-
toString
-