Package org.eclipse.swt.printing
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)
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
FieldsModifier and TypeFieldDescriptionstatic final PageSizeISO A3 size: 297 x 420 mm (842 x 1191 points)static final PageSizeISO A4 size: 210 x 297 mm (595 x 842 points)static final PageSizeISO A5 size: 148 x 210 mm (420 x 595 points)static final PageSizeUS Executive size: 7.25 x 10.5 inches (522 x 756 points)static final PageSizeUS Legal size: 8.5 x 14 inches (612 x 1008 points)static final PageSizeUS Letter size: 8.5 x 11 inches (612 x 792 points)static final PageSizeUS Tabloid size: 11 x 17 inches (792 x 1224 points) -
Constructor Summary
ConstructorsConstructorDescriptionPageSize(double width, double height) Creates an instance of aPageSizerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleheight()Returns the value of theheightrecord component.final StringtoString()Returns a string representation of this record class.doublewidth()Returns the value of thewidthrecord component.
-
Field Details
-
LETTER
US Letter size: 8.5 x 11 inches (612 x 792 points) -
LEGAL
US Legal size: 8.5 x 14 inches (612 x 1008 points) -
A3
ISO A3 size: 297 x 420 mm (842 x 1191 points) -
A4
ISO A4 size: 210 x 297 mm (595 x 842 points) -
A5
ISO A5 size: 148 x 210 mm (420 x 595 points) -
EXECUTIVE
US Executive size: 7.25 x 10.5 inches (522 x 756 points) -
TABLOID
US Tabloid size: 11 x 17 inches (792 x 1224 points)
-
-
Constructor Details
-
Method Details
-
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. -
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. -
equals
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 '=='. -
width
public double width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public double height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-