Enum Class PageSize
- All Implemented Interfaces:
Serializable, Comparable<PageSize>, Constable
PDF Page Size - Standard page dimensions
PDF 页面大小 - 标准页面尺寸
Provides standard page sizes in points (1 inch = 72 points).
提供以点为单位的标准页面大小(1英寸 = 72点)。
Features | 主要功能:
- ISO A and B series page sizes - ISO A 和 B 系列页面大小
- US standard sizes (Letter, Legal, Tabloid) - 美国标准尺寸
- Dimensions in points, millimeters, and inches - 点、毫米和英寸单位的尺寸
- Custom page size support - 自定义页面大小支持
Usage Examples | 使用示例:
PageSize size = PageSize.A4;
float width = size.getWidth(); // 595 points
float widthMm = size.getWidthMm(); // ~210 mm
float[] custom = PageSize.customMm(100, 200);
Security | 安全性:
- Thread-safe: Yes — immutable enum - 线程安全: 是 — 不可变枚举
- Null-safe: N/A — enum values are never null - 空值安全: 不适用 — 枚举值不会为空
- Since:
- JDK 25, opencode-base-pdf V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA0: 841 x 1189 mmA1: 594 x 841 mmA2: 420 x 594 mmA3: 297 x 420 mmA4: 210 x 297 mm (most common) | A4: 210 x 297 毫米(最常用)A5: 148 x 210 mmA6: 105 x 148 mmB4: 250 x 353 mmB5: 176 x 250 mmExecutive: 7.25 x 10.5 inchesLegal: 8.5 x 14 inchesLetter: 8.5 x 11 inchesPostcard: 100 x 148 mmTabloid/Ledger: 11 x 17 inches -
Method Summary
Modifier and TypeMethodDescriptionstatic float[]custom(float widthPt, float heightPt) Creates a custom page size 创建自定义页面大小static float[]customInches(float widthIn, float heightIn) Creates a custom page size from inches 从英寸创建自定义页面大小static float[]customMm(float widthMm, float heightMm) Creates a custom page size from millimeters 从毫米创建自定义页面大小floatGets height in points 获取高度(点)floatGets height in inches 获取高度(英寸)floatGets height in millimeters 获取高度(毫米)floatgetWidth()Gets width in points 获取宽度(点)floatGets width in inches 获取宽度(英寸)floatGets width in millimeters 获取宽度(毫米)float[]rotate()Creates a rotated (landscape) version of this page size 创建旋转(横向)版本的页面大小static PageSizeReturns the enum constant of this class with the specified name.static PageSize[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
A0
A0: 841 x 1189 mm -
A1
A1: 594 x 841 mm -
A2
A2: 420 x 594 mm -
A3
A3: 297 x 420 mm -
A4
A4: 210 x 297 mm (most common) | A4: 210 x 297 毫米(最常用) -
A5
A5: 148 x 210 mm -
A6
A6: 105 x 148 mm -
B4
B4: 250 x 353 mm -
B5
B5: 176 x 250 mm -
LETTER
Letter: 8.5 x 11 inches -
LEGAL
Legal: 8.5 x 14 inches -
TABLOID
Tabloid/Ledger: 11 x 17 inches -
EXECUTIVE
Executive: 7.25 x 10.5 inches -
POSTCARD
Postcard: 100 x 148 mm
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getWidth
public float getWidth()Gets width in points 获取宽度(点)- Returns:
- width | 宽度
-
getHeight
public float getHeight()Gets height in points 获取高度(点)- Returns:
- height | 高度
-
getWidthMm
public float getWidthMm()Gets width in millimeters 获取宽度(毫米)- Returns:
- width in mm | 宽度(毫米)
-
getHeightMm
public float getHeightMm()Gets height in millimeters 获取高度(毫米)- Returns:
- height in mm | 高度(毫米)
-
getWidthInches
public float getWidthInches()Gets width in inches 获取宽度(英寸)- Returns:
- width in inches | 宽度(英寸)
-
getHeightInches
public float getHeightInches()Gets height in inches 获取高度(英寸)- Returns:
- height in inches | 高度(英寸)
-
rotate
public float[] rotate()Creates a rotated (landscape) version of this page size 创建旋转(横向)版本的页面大小- Returns:
- rotated dimensions [width, height] | 旋转后的尺寸 [宽, 高]
-
custom
public static float[] custom(float widthPt, float heightPt) Creates a custom page size 创建自定义页面大小- Parameters:
widthPt- width in points | 宽度(点)heightPt- height in points | 高度(点)- Returns:
- dimensions array [width, height] | 尺寸数组 [宽, 高]
-
customMm
public static float[] customMm(float widthMm, float heightMm) Creates a custom page size from millimeters 从毫米创建自定义页面大小- Parameters:
widthMm- width in mm | 宽度(毫米)heightMm- height in mm | 高度(毫米)- Returns:
- dimensions array [width, height] in points | 尺寸数组 [宽, 高](点)
-
customInches
public static float[] customInches(float widthIn, float heightIn) Creates a custom page size from inches 从英寸创建自定义页面大小- Parameters:
widthIn- width in inches | 宽度(英寸)heightIn- height in inches | 高度(英寸)- Returns:
- dimensions array [width, height] in points | 尺寸数组 [宽, 高](点)
-