Enum Class PageSize

java.lang.Object
java.lang.Enum<PageSize>
cloud.opencode.base.pdf.document.PageSize
All Implemented Interfaces:
Serializable, Comparable<PageSize>, Constable

public enum PageSize extends Enum<PageSize>
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 Constants
    Enum Constant
    Description
    A0: 841 x 1189 mm
    A1: 594 x 841 mm
    A2: 420 x 594 mm
    A3: 297 x 420 mm
    A4: 210 x 297 mm (most common) | A4: 210 x 297 毫米(最常用)
    A5: 148 x 210 mm
    A6: 105 x 148 mm
    B4: 250 x 353 mm
    B5: 176 x 250 mm
    Executive: 7.25 x 10.5 inches
    Legal: 8.5 x 14 inches
    Letter: 8.5 x 11 inches
    Postcard: 100 x 148 mm
    Tabloid/Ledger: 11 x 17 inches
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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 从毫米创建自定义页面大小
    float
    Gets height in points 获取高度(点)
    float
    Gets height in inches 获取高度(英寸)
    float
    Gets height in millimeters 获取高度(毫米)
    float
    Gets width in points 获取宽度(点)
    float
    Gets width in inches 获取宽度(英寸)
    float
    Gets width in millimeters 获取宽度(毫米)
    float[]
    Creates a rotated (landscape) version of this page size 创建旋转(横向)版本的页面大小
    static PageSize
    Returns the enum constant of this class with the specified name.
    static PageSize[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • A0

      public static final PageSize A0
      A0: 841 x 1189 mm
    • A1

      public static final PageSize A1
      A1: 594 x 841 mm
    • A2

      public static final PageSize A2
      A2: 420 x 594 mm
    • A3

      public static final PageSize A3
      A3: 297 x 420 mm
    • A4

      public static final PageSize A4
      A4: 210 x 297 mm (most common) | A4: 210 x 297 毫米(最常用)
    • A5

      public static final PageSize A5
      A5: 148 x 210 mm
    • A6

      public static final PageSize A6
      A6: 105 x 148 mm
    • B4

      public static final PageSize B4
      B4: 250 x 353 mm
    • B5

      public static final PageSize B5
      B5: 176 x 250 mm
    • LETTER

      public static final PageSize LETTER
      Letter: 8.5 x 11 inches
    • TABLOID

      public static final PageSize TABLOID
      Tabloid/Ledger: 11 x 17 inches
    • EXECUTIVE

      public static final PageSize EXECUTIVE
      Executive: 7.25 x 10.5 inches
    • POSTCARD

      public static final PageSize POSTCARD
      Postcard: 100 x 148 mm
  • Method Details

    • values

      public static PageSize[] 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

      public static PageSize valueOf(String name)
      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 name
      NullPointerException - 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 | 尺寸数组 [宽, 高](点)