Instances of this class control the color state, paper size (media type), orientation, logical origin, print quality, and resolution of every page which uses the instance. Attribute names are compliant with the Internet Printing Protocol (IPP) 1.1 where possible. Attribute values are partially compliant where possible.
To use a method which takes an inner class type, pass a reference to one of the constant fields of the inner class. Client code cannot create new instances of the inner class types because none of those classes has a public constructor. For example, to set the color state to monochrome, use the following code:
import java.awt.PageAttributes;
public class MonochromeExample {
public void setMonochrome(PageAttributes pageAttributes) {
pageAttributes.setColor(PageAttributes.ColorType.MONOCHROME);
}
}
Every IPP attribute which supports an attributeName-default value
has a corresponding setattributeNameToDefault method.
Default value fields are not provided.
| Modifier and Type | Class and Description |
|---|---|
| public static class | PageAttributes.
A type-safe enumeration of possible color states. |
| public static class | PageAttributes.
A type-safe enumeration of possible paper sizes. |
| public static class | PageAttributes.
A type-safe enumeration of possible orientations. |
| public static class | PageAttributes.
A type-safe enumeration of possible origins. |
| public static class | PageAttributes.
A type-safe enumeration of possible print qualities. |
| Modifier and Type | Field and Description |
|---|---|
| private PageAttributes. | |
| private PageAttributes. | |
| private PageAttributes. | |
| private PageAttributes. | |
| private int[] | |
| private PageAttributes. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PageAttributes(PageAttributes
the PageAttributes to copy. obj)Constructs a PageAttributes instance which is a copy of the supplied PageAttributes. |
| public | PageAttributes(PageAttributes.
ColorType.COLOR or ColorType.MONOCHROME. color,one of the constant fields of the MediaType class. media,OrientationRequestedType.PORTRAIT or
OrientationRequestedType.LANDSCAPE. orientationRequested,OriginType.PHYSICAL or OriginType.PRINTABLE origin,PrintQualityType.DRAFT, PrintQualityType.NORMAL,
or PrintQualityType.HIGH printQuality,an integer array of 3 elements. The first
element must be greater than 0. The second element must be
must be greater than 0. The third element must be either
printerResolution)3 or 4.Constructs a PageAttributes instance with the specified values for every attribute. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: the newly created copy. It is safe to cast this Object into a PageAttributes.Overrides java. Creates and returns a copy of this PageAttributes. |
| public boolean | Returns: whether obj is equal to this PageAttribute according to the above criteria.the object whose equality will be checked. obj)Overrides java. Determines whether two PageAttributes are equal to each other. |
| public PageAttributes. | Returns: ColorType.COLOR or ColorType.MONOCHROME.Returns whether pages using these attributes will be rendered in color or monochrome. |
| public PageAttributes. | Returns: one of the constant fields of the MediaType class.Returns the paper size for pages using these attributes. |
| public PageAttributes. | Returns: OrientationRequestedType.PORTRAIT or OrientationRequestedType.LANDSCAPE.Returns the print orientation for pages using these attributes. |
| public PageAttributes. | Returns: OriginType.PHYSICAL or OriginType.PRINTABLEReturns whether drawing at (0, 0) to pages using these attributes draws at the upper-left corner of the physical page, or at the upper-left corner of the printable area. |
| public int[] | Returns: an integer array of 3 elements. The first element must be greater than 0. The second element must be must be greater than 0. The third element must be either3 or 4.Returns the print resolution for pages using these attributes. |
| public PageAttributes. | Returns: PrintQualityType.DRAFT, PrintQualityType.NORMAL, or PrintQualityType.HIGHReturns the print quality for pages using these attributes. |
| public int | Returns: the hash code.Overrides java. Returns a hash code value for this PageAttributes. |
| public void | set(PageAttributes
the PageAttributes to copy. obj)Sets all of the attributes of this PageAttributes to the same values as the attributes of obj. |
| public void | setColor(PageAttributes.
ColorType.COLOR or ColorType.MONOCHROME. colorSpecifies whether pages using these attributes will be rendered in color or monochrome. |
| public void | setMedia(PageAttributes.
one of the constant fields of the MediaType class. mediaSpecifies the desired paper size for pages using these attributes. |
| public void | setMediaToDefault()
Sets the paper size for pages using these attributes to the default size for the default locale. |
| public void | setOrientationRequested(PageAttributes.
OrientationRequestedType.PORTRAIT or
OrientationRequestedType.LANDSCAPE. orientationRequestedSpecifies the print orientation for pages using these attributes. |
| public void | setOrientationRequested(int
3 or 4Specifies the print orientation for pages using these attributes. |
| public void | setOrientationRequestedToDefault()
Sets the print orientation for pages using these attributes to the default. |
| public void | setOrigin(PageAttributes.
OriginType.PHYSICAL or OriginType.PRINTABLE originSpecifies whether drawing at (0, 0) to pages using these attributes draws at the upper-left corner of the physical page, or at the upper-left corner of the printable area. |
| public void | setPrinterResolution(int[]
an integer array of 3 elements. The first
element must be greater than 0. The second element must be
must be greater than 0. The third element must be either
printerResolution)3 or 4.Specifies the desired print resolution for pages using these attributes. |
| public void | setPrinterResolution(int
an integer greater than 0. printerResolution)Specifies the desired cross feed and feed print resolutions in dots per inch for pages using these attributes. |
| public void | setPrinterResolutionToDefault()
Sets the printer resolution for pages using these attributes to the default. |
| public void | setPrintQuality(PageAttributes.
PrintQualityType.DRAFT, PrintQualityType.NORMAL,
or PrintQualityType.HIGH printQualitySpecifies the print quality for pages using these attributes. |
| public void | setPrintQuality(int
3, 4, or 5Specifies the print quality for pages using these attributes. |
| public void | |
| public String | Returns: the string representation.Overrides java. Returns a string representation of this PageAttributes. |