# Record Class PageSize

java.lang.Object
java.lang.Record
org.eclipse.swt.printing.PageSize

Record Components:
  `width` - the width of the page in points (1/72 inch)
  `height` - the height of the page in points (1/72 inch)

public record PageSize(double width, double height) extends Record
A `PageSize` represents the dimensions of a page in points (1 point = 1/72 inch), as used in PDF documents and printing.

This record provides predefined constants for common paper sizes that are supported across all platforms (Windows, GTK, macOS). Using these constants avoids confusion between points and pixels and ensures consistent page dimensions.

Example usage:

       PDFDocument pdf = new PDFDocument("output.pdf", PageSize.A4);
       GC gc = new GC(pdf);
       gc.drawText("Hello, PDF!", 100, 100);
       gc.dispose();
       pdf.dispose();

Since:
  3.133
Restriction:
  This class is provisional API and subject to change. It is being made available to gather early feedback. The API or behavior may change in future releases as the implementation evolves based on user feedback.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final PageSize`
`A3`
ISO A3 size: 297 x 420 mm (842 x 1191 points)
`static final PageSize`
`A4`
ISO A4 size: 210 x 297 mm (595 x 842 points)
`static final PageSize`
`A5`
ISO A5 size: 148 x 210 mm (420 x 595 points)
`static final PageSize`
`EXECUTIVE`
US Executive size: 7.25 x 10.5 inches (522 x 756 points)
`static final PageSize`
`LEGAL`
US Legal size: 8.5 x 14 inches (612 x 1008 points)
`static final PageSize`
`LETTER`
US Letter size: 8.5 x 11 inches (612 x 792 points)
`static final PageSize`
`TABLOID`
US Tabloid size: 11 x 17 inches (792 x 1224 points)

## Constructor Summary

Constructors
Constructor
Description
`PageSize(double width, double height)`
Creates an instance of a `PageSize` record class.

## Method Summary

Modifier and Type
Method
Description
`final boolean`
`equals(Object o)`
Indicates whether some other object is "equal to" this one.
`final int`
`hashCode()`
Returns a hash code value for this object.
`double`
`height()`
Returns the value of the `height` record component.
`final String`
`toString()`
Returns a string representation of this record class.
`double`
`width()`
Returns the value of the `width` record component.

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### LETTER

public static final PageSize LETTER
US Letter size: 8.5 x 11 inches (612 x 792 points)

### LEGAL

public static final PageSize LEGAL
US Legal size: 8.5 x 14 inches (612 x 1008 points)

### A3

public static final PageSize A3
ISO A3 size: 297 x 420 mm (842 x 1191 points)

### A4

public static final PageSize A4
ISO A4 size: 210 x 297 mm (595 x 842 points)

### A5

public static final PageSize A5
ISO A5 size: 148 x 210 mm (420 x 595 points)

### EXECUTIVE

public static final PageSize EXECUTIVE
US Executive size: 7.25 x 10.5 inches (522 x 756 points)

### TABLOID

public static final PageSize TABLOID
US Tabloid size: 11 x 17 inches (792 x 1224 points)

## Constructor Details

### PageSize

public PageSize(double width, double height)
Creates an instance of a `PageSize` record class.

Parameters:
  `width` - the value for the `width` record component
  `height` - the value for the `height` record component

## Method Details

### toString

public final String toString()
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.

Specified by:
  `toString` in class `Record`
Returns:
  a string representation of this object

### hashCode

public final int hashCode()
Returns a hash code value for this object. The value is derived from the hash code of each of the record components.

Specified by:
  `hashCode` in class `Record`
Returns:
  a hash code value for this object

### equals

public final boolean equals(Object o)
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the `compare` method from their corresponding wrapper classes.

Specified by:
  `equals` in class `Record`
Parameters:
  `o` - the object with which to compare
Returns:
  `true` if this object is the same as the `o` argument; `false` otherwise.

### width

public double width()
Returns the value of the `width` record component.

Returns:
  the value of the `width` record component

### height

public double height()
Returns the value of the `height` record component.

Returns:
  the value of the `height` record component