Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public static final class

PrinterCapabilitiesInfo.Builder

extends Object
java.lang.Object
   ↳ android.print.PrinterCapabilitiesInfo.Builder

Class Overview

Builder for creating of a PrinterCapabilitiesInfo . This class is responsible to enforce that all required attributes have at least one default value. In other words, this class creates only well-formed PrinterCapabilitiesInfo s.

Look at the individual methods for a reference whether a property is required or if it is optional.

Summary

Public Constructors
PrinterCapabilitiesInfo.Builder ( PrinterId printerId)
Creates a new instance.
Public Methods
PrinterCapabilitiesInfo.Builder addMediaSize ( PrintAttributes.MediaSize mediaSize, boolean isDefault)
Adds a supported media size.
PrinterCapabilitiesInfo.Builder addResolution ( PrintAttributes.Resolution resolution, boolean isDefault)
Adds a supported resolution.
PrinterCapabilitiesInfo build ()
Crates a new PrinterCapabilitiesInfo enforcing that all required properties have been specified.
PrinterCapabilitiesInfo.Builder setColorModes (int colorModes, int defaultColorMode)
Sets the color modes.
PrinterCapabilitiesInfo.Builder setMinMargins ( PrintAttributes.Margins margins)
Sets the minimal margins.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PrinterCapabilitiesInfo.Builder ( PrinterId printerId)

Creates a new instance.

Parameters
printerId The printer id. Cannot be null .
Throws
IllegalArgumentException If the printer id is null .

Public Methods

public PrinterCapabilitiesInfo.Builder addMediaSize ( PrintAttributes.MediaSize mediaSize, boolean isDefault)

Adds a supported media size.

Required: Yes

Parameters
mediaSize A media size.
isDefault Whether this is the default.
Returns
  • This builder.
Throws
IllegalArgumentException If set as default and there is already a default.

public PrinterCapabilitiesInfo.Builder addResolution ( PrintAttributes.Resolution resolution, boolean isDefault)

Adds a supported resolution.

Required: Yes

Parameters
resolution A resolution.
isDefault Whether this is the default.
Returns
  • This builder.
Throws
IllegalArgumentException If set as default and there is already a default.

public PrinterCapabilitiesInfo build ()

Crates a new PrinterCapabilitiesInfo enforcing that all required properties have been specified. See individual methods in this class for reference about required attributes.

Throws
IllegalStateException If a required attribute was not specified.

public PrinterCapabilitiesInfo.Builder setColorModes (int colorModes, int defaultColorMode)

Sets the color modes.

Required: Yes

Parameters
colorModes The color mode bit mask.
defaultColorMode The default color mode.
Returns
  • This builder.

    Note: On platform version 19 (Kitkat) specifying only PrintAttributes#COLOR_MODE_MONOCHROME leads to a print spooler crash. Hence, you should declare either both color modes or PrintAttributes#COLOR_MODE_COLOR.

Throws
IllegalArgumentException If color modes contains an invalid mode bit or if the default color mode is invalid.

public PrinterCapabilitiesInfo.Builder setMinMargins ( PrintAttributes.Margins margins)

Sets the minimal margins. These are the minimal margins the printer physically supports.

Required: Yes

Parameters
margins The margins.
Returns
  • This builder.
Throws
IllegalArgumentException If margins are null .