PrintHelper

public final class PrintHelper
extends Object

java.lang.Object
   ↳ androidx.print.PrintHelper


Helper for printing bitmaps.

Summary

Nested classes

interface PrintHelper.OnPrintFinishCallback

Callback for observing when a print operation is completed. 

Constants

int COLOR_MODE_COLOR

this is a color image (default)

int COLOR_MODE_MONOCHROME

this is a black and white image

int ORIENTATION_LANDSCAPE

Print the image in landscape orientation (default).

int ORIENTATION_PORTRAIT

Print the image in portrait orientation.

int SCALE_MODE_FILL

image will fill the paper and be cropped (default)

int SCALE_MODE_FIT

image will be scaled but leave white space

Public constructors

PrintHelper(Context context)

Constructs the PrintHelper that can be used to print images.

Public methods

int getColorMode()

Gets the color mode with which the image will be printed.

int getOrientation()

Gets whether the image will be printed in landscape or portrait.

int getScaleMode()

Returns the scale mode with which the image will fill the paper.

void printBitmap(String jobName, Bitmap bitmap)

Prints a bitmap.

void printBitmap(String jobName, Uri imageFile, PrintHelper.OnPrintFinishCallback callback)

Prints an image located at the Uri.

void printBitmap(String jobName, Bitmap bitmap, PrintHelper.OnPrintFinishCallback callback)

Prints a bitmap.

void printBitmap(String jobName, Uri imageFile)