# PrintDocumentInfo.Builder

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

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/print/PrintDocumentInfo.Builder "View this page in Java")  

```
class Builder
```

|---|------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                     ||
| ↳ | [android.print.PrintDocumentInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#) |

Builder for creating a[PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo).

## Summary

|                                                                                                          Public constructors                                                                                                           ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#Builder(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Constructor. |

|                                                                                                                                                                                   Public methods                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo)                  | [build](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#build())`()` Creates a new[PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo)instance.                        |
| [PrintDocumentInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#) | [setContentType](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#setContentType(kotlin.Int))`(`type:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the content type.           |
| [PrintDocumentInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#) | [setPageCount](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#setPageCount(kotlin.Int))`(`pageCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the total number of pages. |

## Public constructors

### Builder

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

```
Builder(name: String)
```

Constructor.

The values of the relevant properties are initialized with defaults. Please refer to the documentation of the individual setters for information about the default values.

|                                                                                                                         Parameters                                                                                                                         ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The document name which may be shown to the user and is the file name if the content it describes is saved as a PDF. Cannot be empty. This value cannot be`null`. |

## Public methods

### build

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

```
fun build(): PrintDocumentInfo
```

Creates a new[PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo)instance.

|                                                                       Return                                                                       ||
|-----------------------------------------------------------------------------------------------------|-----------------------------------------------|
| [PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo) | The new instance. This value cannot be`null`. |

### setContentType

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

```
fun setContentType(type: Int): PrintDocumentInfo.Builder
```

Sets the content type.

**Default:** [CONTENT_TYPE_DOCUMENT](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#CONTENT_TYPE_DOCUMENT:kotlin.Int)

|                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                             ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The content type. Value is[android.print.PrintDocumentInfo#CONTENT_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#CONTENT_TYPE_UNKNOWN:kotlin.Int),[android.print.PrintDocumentInfo#CONTENT_TYPE_DOCUMENT](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#CONTENT_TYPE_DOCUMENT:kotlin.Int), or[android.print.PrintDocumentInfo#CONTENT_TYPE_PHOTO](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#CONTENT_TYPE_PHOTO:kotlin.Int) |

|                                                                             Return                                                                              ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrintDocumentInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#) | This builder. This value cannot be`null`. |

**See Also**

- [#CONTENT_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#CONTENT_TYPE_UNKNOWN:kotlin.Int)
- [#CONTENT_TYPE_DOCUMENT](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#CONTENT_TYPE_DOCUMENT:kotlin.Int)
- [#CONTENT_TYPE_PHOTO](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#CONTENT_TYPE_PHOTO:kotlin.Int)  

### setPageCount

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

```
fun setPageCount(pageCount: Int): PrintDocumentInfo.Builder
```

Sets the total number of pages.

**Default:** [PAGE_COUNT_UNKNOWN](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#PAGE_COUNT_UNKNOWN:kotlin.Int)

|                                                                                                                                                            Parameters                                                                                                                                                             ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pageCount` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of pages. Must be greater than or equal to zero or[PrintDocumentInfo.PAGE_COUNT_UNKNOWN](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo#PAGE_COUNT_UNKNOWN:kotlin.Int). Value is -1 or greater |

|                                                                             Return                                                                              ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrintDocumentInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo.Builder#) | This builder. This value cannot be`null`. |