PrintHelper
class PrintHelper
kotlin.Any | |
↳ | androidx.print.PrintHelper |
Helper for printing bitmaps.
Summary
Nested classes | |
---|---|
abstract |
Callback for observing when a print operation is completed. |
Constants | |
---|---|
static Int |
this is a color image (default) |
static Int |
this is a black and white image |
static Int |
Print the image in landscape orientation (default). |
static Int |
Print the image in portrait orientation. |
static Int |
image will fill the paper and be cropped (default) |
static Int |
image will be scaled but leave white space |
Public constructors | |
---|---|
Constructs the PrintHelper that can be used to print images. |
Public methods | |
---|---|
Int |
Gets the color mode with which the image will be printed. |
Int |
Gets whether the image will be printed in landscape or portrait. |
Int |
Returns the scale mode with which the image will fill the paper. |
Unit |
printBitmap(@NonNull jobName: String, @NonNull bitmap: Bitmap) Prints a bitmap. |
Unit |
printBitmap(@NonNull jobName: String, @NonNull bitmap: Bitmap, @Nullable callback: PrintHelper.OnPrintFinishCallback?) Prints a bitmap. |
Unit |
printBitmap(@NonNull jobName: String, @NonNull imageFile: Uri) Prints an image located at the Uri. |
Unit |
printBitmap(@NonNull jobName: String, @NonNull imageFile: Uri, @Nullable callback: PrintHelper.OnPrintFinishCallback?) Prints an image located at the Uri. |
Unit |
setColorMode(colorMode: Int) Sets whether the image will be printed in color (default) |
Unit |
setOrientation(orientation: Int) Sets whether the image will be printed in landscape |
Unit |
setScaleMode(scaleMode: Int) Selects whether the image will fill the paper and be cropped |
static Boolean |
Gets whether the system supports printing. |
Constants
COLOR_MODE_COLOR
static val COLOR_MODE_COLOR: Int
this is a color image (default)
Value: PrintAttributes.COLOR_MODE_COLOR
COLOR_MODE_MONOCHROME
static val COLOR_MODE_MONOCHROME: Int
this is a black and white image
Value: PrintAttributes.COLOR_MODE_MONOCHROME
ORIENTATION_LANDSCAPE
static val ORIENTATION_LANDSCAPE: Int
Print the image in landscape orientation (default).
Value: 1
ORIENTATION_PORTRAIT
static val ORIENTATION_PORTRAIT: Int
Print the image in portrait orientation.
Value: 2
SCALE_MODE_FILL
static val SCALE_MODE_FILL: Int
image will fill the paper and be cropped (default)
Value: 2
Public constructors
<init>
PrintHelper(@NonNull context: Context)
Constructs the PrintHelper that can be used to print images.
Parameters | |
---|---|
context |
Context: A context for accessing system resources. |
Public methods
getColorMode
fun getColorMode(): Int
Gets the color mode with which the image will be printed.
Return | |
---|---|
Int |
The color mode which is one of COLOR_MODE_COLOR and COLOR_MODE_MONOCHROME . |
getOrientation
fun getOrientation(): Int
Gets whether the image will be printed in landscape or portrait.
Return | |
---|---|
Int |
The page orientation which is one of ORIENTATION_LANDSCAPE or ORIENTATION_PORTRAIT . |
getScaleMode
fun getScaleMode()