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/PrintAttributes.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/print/PrintAttributes.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/print/PrintAttributes.Builder#inhmethods)

# PrintAttributes.Builder

*** ** * ** ***


`
public
static
final

class
PrintAttributes.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

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

<br />

*** ** * ** ***

Builder for creating `https://developer.android.com/reference/android/print/PrintAttributes`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/print/PrintAttributes.Builder#Builder()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/print/PrintAttributes` | ` https://developer.android.com/reference/android/print/PrintAttributes.Builder#build()() ` Creates a new `https://developer.android.com/reference/android/print/PrintAttributes` instance. |
| ` https://developer.android.com/reference/android/print/PrintAttributes.Builder` | ` https://developer.android.com/reference/android/print/PrintAttributes.Builder#setColorMode(int)(int colorMode) ` Sets the color mode. |
| ` https://developer.android.com/reference/android/print/PrintAttributes.Builder` | ` https://developer.android.com/reference/android/print/PrintAttributes.Builder#setDuplexMode(int)(int duplexMode) ` Sets the duplex mode. |
| ` https://developer.android.com/reference/android/print/PrintAttributes.Builder` | ` https://developer.android.com/reference/android/print/PrintAttributes.Builder#setMediaSize(android.print.PrintAttributes.MediaSize)(https://developer.android.com/reference/android/print/PrintAttributes.MediaSize mediaSize) ` Sets the media size. |
| ` https://developer.android.com/reference/android/print/PrintAttributes.Builder` | ` https://developer.android.com/reference/android/print/PrintAttributes.Builder#setMinMargins(android.print.PrintAttributes.Margins)(https://developer.android.com/reference/android/print/PrintAttributes.Margins margins) ` Sets the minimal margins. |
| ` https://developer.android.com/reference/android/print/PrintAttributes.Builder` | ` https://developer.android.com/reference/android/print/PrintAttributes.Builder#setResolution(android.print.PrintAttributes.Resolution)(https://developer.android.com/reference/android/print/PrintAttributes.Resolution resolution) ` Sets the resolution. |

| ### 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

```
public Builder ()
```

<br />

<br />

## Public methods

### build

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

```
public PrintAttributes build ()
```

Creates a new `https://developer.android.com/reference/android/print/PrintAttributes` instance.

<br />

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

### setColorMode

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

```
public PrintAttributes.Builder setColorMode (int colorMode)
```

Sets the color mode.

<br />

| Parameters ||
|---|---|
| `colorMode` | `int`: A valid color mode or zero. 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/PrintAttributes.Builder` | This builder. This value cannot be `null`. <br /> |

**See also:**

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

### setDuplexMode

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

```
public PrintAttributes.Builder setDuplexMode (int duplexMode)
```

Sets the duplex mode.

<br />

| Parameters ||
|---|---|
| `duplexMode` | `int`: A valid duplex mode or zero. 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/PrintAttributes.Builder` | This builder. This value cannot be `null`. <br /> |

**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`

### setMediaSize

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

```
public PrintAttributes.Builder setMediaSize (PrintAttributes.MediaSize mediaSize)
```

Sets the media size.

<br />

| Parameters ||
|---|---|
| `mediaSize` | `PrintAttributes.MediaSize`: The media size. This value cannot be `null`. <br /> |

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

### setMinMargins

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

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

Sets the minimal margins. If the content does not fit
these margins it will be clipped.

<br />

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

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

### setResolution

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

```
public PrintAttributes.Builder setResolution (PrintAttributes.Resolution resolution)
```

Sets the resolution.

<br />

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

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