Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#inhmethods)

# PrinterCapabilitiesInfo.Builder

*** ** * ** ***

` public static final class PrinterCapabilitiesInfo.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.print.PrinterCapabilitiesInfo.Builder |

<br />

*** ** * ** ***

Builder for creating of a `https://developer.android.com/reference/android/print/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 `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo`s.

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

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#Builder(android.print.PrinterId)(https://developer.android.com/reference/android/print/PrinterId printerId) ` Creates a new instance. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#addMediaSize(android.print.PrintAttributes.MediaSize,%20boolean)(https://developer.android.com/reference/android/print/PrintAttributes.MediaSize mediaSize, boolean isDefault) ` Adds a supported media size. |
| ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#addResolution(android.print.PrintAttributes.Resolution,%20boolean)(https://developer.android.com/reference/android/print/PrintAttributes.Resolution resolution, boolean isDefault) ` Adds a supported resolution. |
| ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo` | ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#build()() ` Crates a new `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo` enforcing that all required properties have been specified. |
| ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#setColorModes(int,%20int)(int colorModes, int defaultColorMode) ` Sets the color modes. |
| ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#setDuplexModes(int,%20int)(int duplexModes, int defaultDuplexMode) ` Sets the duplex modes. |
| ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | ` https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder#setMinMargins(android.print.PrintAttributes.Margins)(https://developer.android.com/reference/android/print/PrintAttributes.Margins margins) ` Sets the minimal margins. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### Builder

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (PrinterId printerId)
```

Creates a new instance.

<br />

| Parameters ||
|---|---|
| `printerId` | `PrinterId`: The printer id. Cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the printer id is `null`. |

## Public methods

### addMediaSize

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Adds a supported media size.

**Required:** Yes

<br />

<br />

| Parameters ||
|---|---|
| `mediaSize` | `PrintAttributes.MediaSize`: A media size. This value cannot be `null`. <br /> |
| `isDefault` | `boolean`: Whether this is the default. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | This builder. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If set as default and there is already a default. |

**See also:**

- `https://developer.android.com/reference/android/print/PrintAttributes.MediaSize`

### addResolution

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Adds a supported resolution.

**Required:** Yes

<br />

<br />

| Parameters ||
|---|---|
| `resolution` | `PrintAttributes.Resolution`: A resolution. This value cannot be `null`. <br /> |
| `isDefault` | `boolean`: Whether this is the default. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | This builder. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If set as default and there is already a default. |

**See also:**

- `https://developer.android.com/reference/android/print/PrintAttributes.Resolution`

### build

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PrinterCapabilitiesInfo build ()
```

Crates a new `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo` enforcing that all required properties have been specified. See individual methods in this class for reference about required attributes.

**Note:** If you do not add supported duplex modes, `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_NONE` will set as the only supported mode and also as the default duplex mode.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo` | A new `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo`. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | If a required attribute was not specified. |

### setColorModes

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Sets the color modes.

**Required:** Yes

<br />

<br />

| Parameters ||
|---|---|
| `colorModes` | `int`: The color mode bit mask. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/print/PrintAttributes#COLOR_MODE_MONOCHROME` - `https://developer.android.com/reference/android/print/PrintAttributes#COLOR_MODE_COLOR` |
| `defaultColorMode` | `int`: The default color mode. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/print/PrintAttributes#COLOR_MODE_MONOCHROME` - `https://developer.android.com/reference/android/print/PrintAttributes#COLOR_MODE_COLOR` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | 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. . This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If color modes contains an invalid mode bit or if the default color mode is invalid. |

**See also:**

- `https://developer.android.com/reference/android/print/PrintAttributes#COLOR_MODE_COLOR`
- `https://developer.android.com/reference/android/print/PrintAttributes#COLOR_MODE_MONOCHROME`

### setDuplexModes

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PrinterCapabilitiesInfo.Builder setDuplexModes (int duplexModes, 
                int defaultDuplexMode)
```

Sets the duplex modes.

**Required:** No

<br />

<br />

| Parameters ||
|---|---|
| `duplexModes` | `int`: The duplex mode bit mask. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_NONE` - `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_LONG_EDGE` - `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_SHORT_EDGE` |
| `defaultDuplexMode` | `int`: The default duplex mode. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_NONE` - `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_LONG_EDGE` - `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_SHORT_EDGE` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | This builder. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If duplex modes contains an invalid mode bit or if the default duplex mode is invalid. |

**See also:**

- `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_NONE`
- `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_LONG_EDGE`
- `https://developer.android.com/reference/android/print/PrintAttributes#DUPLEX_MODE_SHORT_EDGE`

### setMinMargins

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PrinterCapabilitiesInfo.Builder setMinMargins (PrintAttributes.Margins margins)
```

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

**Required:** Yes

<br />

<br />

| Parameters ||
|---|---|
| `margins` | `PrintAttributes.Margins`: The margins. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/print/PrinterCapabilitiesInfo.Builder` | This builder. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If margins are `null`. |

**See also:**

- `https://developer.android.com/reference/android/print/PrintAttributes.Margins`