Stay organized with collections
Save and categorize content based on your preferences.
PrintDocument
class PrintDocument
This class represents a printed document from the perspective of a print service. It exposes APIs to query the document and obtain its data.
Note: All methods of this class must be executed on the main application thread.
Summary
Public methods
getData
fun getData(): ParcelFileDescriptor?
Gets the data associated with this document.
Note: It is a responsibility of the client to open a stream to the returned file descriptor, fully read the data, and close the file descriptor.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# PrintDocument\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPrintDocument\n=============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/printservice/PrintDocument \"View this page in Java\") \n\n```\nclass PrintDocument\n```\n\n|---|-----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.printservice.PrintDocument](#) |\n\nThis class represents a printed document from the perspective of a print service. It exposes APIs to query the document and obtain its data.\n\n**Note:** All methods of this class must be executed on the main application thread.\n\nSummary\n-------\n\n| Public methods ||\n|-----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|\n| [ParcelFileDescriptor](../os/ParcelFileDescriptor.html#)? | [getData](#getData())`()` Gets the data associated with this document. |\n| [PrintDocumentInfo](../print/PrintDocumentInfo.html#) | [getInfo](#getInfo())`()` Gets the [PrintDocumentInfo](../print/PrintDocumentInfo.html#) that describes this document. |\n\nPublic methods\n--------------\n\n### getData\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getData(): ParcelFileDescriptor?\n```\n\nGets the data associated with this document.\n\n**Note:** It is a responsibility of the client to open a stream to the returned file descriptor, fully read the data, and close the file descriptor.\n\n| Return ||\n|-----------------------------------------------------------|-------------------------------------------------------------------|\n| [ParcelFileDescriptor](../os/ParcelFileDescriptor.html#)? | A file descriptor for reading the data. This value may be `null`. |\n\n### getInfo\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getInfo(): PrintDocumentInfo\n```\n\nGets the [PrintDocumentInfo](../print/PrintDocumentInfo.html#) that describes this document.\n\n| Return ||\n|-------------------------------------------------------|-------------------------------------------------|\n| [PrintDocumentInfo](../print/PrintDocumentInfo.html#) | The document info. This value cannot be `null`. |"]]