PrintJobInfo
public
final
class
PrintJobInfo
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.print.PrintJobInfo |
This class represents the description of a print job. The print job state includes properties such as its id, print attributes used for generating the content, and so on. Note that the print jobs state may change over time and this class represents a snapshot of this state.
Summary
Nested classes | |
---|---|
class |
PrintJobInfo.Builder
Builder for creating a |
Constants | |
---|---|
int |
STATE_BLOCKED
Print job state: The print job is blocked. |
int |
STATE_CANCELED
Print job state: The print job is canceled. |
int |
STATE_COMPLETED
Print job state: The print job is successfully printed. |
int |
STATE_CREATED
Print job state: The print job is being created but not yet ready to be printed. |
int |
STATE_FAILED
Print job state: The print job was printing but printing failed. |
int |
STATE_QUEUED
Print job state: The print jobs is created, it is ready to be printed and should be processed. |
int |
STATE_STARTED
Print job state: The print job is being printed. |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<PrintJobInfo> |
CREATOR
|
Public methods | |
---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
int
|
getAdvancedIntOption(String key)
Gets the value of an advanced (printer specific) print option. |
String
|
getAdvancedStringOption(String key)
Gets the value of an advanced (printer specific) print option. |
PrintAttributes
|
getAttributes()
Gets the print job attributes. |
int
|
getCopies()
Gets the number of copies. |
long
|
getCreationTime()
Gets the wall time in millisecond when this print job was created. |
PrintJobId
|
getId()
Gets the unique print job id. |
String
|
getLabel()
Gets the human readable job label. |
PageRange[]
|
getPages()
Gets the included pages. |
PrinterId
|
getPrinterId()
Gets the unique target printer id. |
int
|
getState()
Gets the current job state. |
boolean
|
hasAdvancedOption(String key)
Gets whether this job has a given advanced (printer specific) print option. |
String
|
toString()
Returns a string representation of the object. |
void
|
writeToParcel(Parcel parcel, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
Constants
STATE_BLOCKED
public static final int STATE_BLOCKED
Print job state: The print job is blocked.
Next valid states: STATE_FAILED
, STATE_CANCELED
,
STATE_STARTED
Constant Value: 4 (0x00000004)
STATE_CANCELED
public static final int STATE_CANCELED
Print job state: The print job is canceled. This is a terminal state.
Next valid states: None
Constant Value: 7 (0x00000007)
STATE_COMPLETED
public static final int STATE_COMPLETED
Print job state: The print job is successfully printed. This is a terminal state.
Next valid states: None
Constant Value: 5 (0x00000005)
STATE_CREATED
public static final int STATE_CREATED
Print job state: The print job is being created but not yet ready to be printed.
Next valid states: STATE_QUEUED
Constant Value: 1 (0x00000001)
STATE_FAILED
public static final int STATE_FAILED
Print job state: The print job was printing but printing failed.
Next valid states: STATE_CANCELED
, STATE_STARTED
Constant Value: 6 (0x00000006)
STATE_QUEUED
public static final int STATE_QUEUED
Print job state: The print jobs is created, it is ready to be printed and should be processed.
Next valid states: STATE_STARTED
, STATE_FAILED
,
STATE_CANCELED
Constant Value: 2 (0x00000002)
STATE_STARTED
public static final int STATE_STARTED
Print job state: The print job is being printed.
Next valid states: STATE_COMPLETED
, STATE_FAILED
,
STATE_CANCELED
, STATE_BLOCKED
Constant Value: 3 (0x00000003)
Fields
Public methods
describeContents
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(android.os.Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
getAdvancedIntOption
public int getAdvancedIntOption (String key)
Gets the value of an advanced (printer specific) print option.
Parameters | |
---|---|
key |
String : The option key. |
Returns | |
---|---|
int |
The option value. |
getAdvancedStringOption
public String getAdvancedStringOption (String key)
Gets the value of an advanced (printer specific) print option.
Parameters | |
---|---|
key |
String : The option key. |
Returns | |
---|---|
String |
The option value. |
getAttributes
public PrintAttributes getAttributes ()
Gets the print job attributes.
Returns | |
---|---|
PrintAttributes |
The attributes.
This value cannot be null . |
getCopies
public int getCopies ()
Gets the number of copies.
Returns | |
---|---|
int |
The number of copies or zero if not set. Value is 0 or greater |
getCreationTime
public long getCreationTime ()
Gets the wall time in millisecond when this print job was created.
Returns | |
---|---|
long |
The creation time in milliseconds. |
getId
public PrintJobId getId ()
Gets the unique print job id.
Returns | |
---|---|
PrintJobId |
The id.
This value may be null . |
getLabel
public String getLabel ()
Gets the human readable job label.
Returns | |
---|---|
String |
The label.
This value cannot be null . |
getPages
public PageRange[] getPages ()
Gets the included pages.
Returns | |
---|---|
PageRange[] |
The included pages or null if not set. |
getPrinterId
public PrinterId getPrinterId ()
Gets the unique target printer id.
Returns | |
---|---|
PrinterId |
The target printer id.
This value may be null . |
getState
public int getState ()
Gets the current job state.
Returns | |
---|---|
int |
The job state.
Value is STATE_CREATED , STATE_QUEUED , STATE_STARTED , STATE_BLOCKED , STATE_COMPLETED , STATE_FAILED , or STATE_CANCELED |
hasAdvancedOption
public boolean hasAdvancedOption (String key)
Gets whether this job has a given advanced (printer specific) print option.
Parameters | |
---|---|
key |
String : The option key. |
Returns | |
---|---|
boolean |
Whether the option is present. |
toString
public String toString ()
Returns a string representation of the object.
Returns | |
---|---|
String |
a string representation of the object. |
writeToParcel
public void writeToParcel (Parcel parcel, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
parcel |
Parcel : The Parcel in which the object should be written.
This value cannot be null . |
flags |
int : Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
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 2024-04-11 UTC.