to top
Android APIs
public class

PrintHelperKitkat

extends Object
java.lang.Object
   ↳ android.support.v4.print.PrintHelperKitkat

Class Overview

Kitkat specific PrintManager API implementation.

Summary

Constants
int COLOR_MODE_COLOR this is a color image (default)
int COLOR_MODE_MONOCHROME this is a black and white image
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 Methods
int getColorMode()
Gets the color mode with which the image will be printed.
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)
Prints an image located at the Uri.
void setColorMode(int colorMode)
Sets whether the image will be printed in color (default) COLOR_MODE_COLOR or in back and white COLOR_MODE_MONOCHROME.
void setScaleMode(int scaleMode)
Selects whether the image will fill the paper and be cropped SCALE_MODE_FIT or whether the image will be scaled but leave white space SCALE_MODE_FILL.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int COLOR_MODE_COLOR

this is a color image (default)

Constant Value: 2 (0x00000002)

public static final int COLOR_MODE_MONOCHROME

this is a black and white image

Constant Value: 1 (0x00000001)

public static final int SCALE_MODE_FILL

image will fill the paper and be cropped (default)

Constant Value: 2 (0x00000002)

public static final int SCALE_MODE_FIT

image will be scaled but leave white space

Constant Value: 1 (0x00000001)

Public Methods

public int getColorMode ()

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

Returns

public int getScaleMode ()

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

Returns

public void printBitmap (String jobName, Bitmap bitmap)

Prints a bitmap.

Parameters
jobName The print job name.
bitmap The bitmap to print.

public void printBitmap (String jobName, Uri imageFile)

Prints an image located at the Uri. Image types supported are those of BitmapFactory.decodeStream (JPEG, GIF, PNG, BMP, WEBP)

Parameters
jobName The print job name.
imageFile The Uri pointing to an image to print.
Throws
FileNotFoundException if Uri is not pointing to a valid image.

public void setColorMode (int colorMode)

Sets whether the image will be printed in color (default) COLOR_MODE_COLOR or in back and white COLOR_MODE_MONOCHROME.

Parameters
colorMode The color mode which is one of COLOR_MODE_COLOR and COLOR_MODE_MONOCHROME.

public void setScaleMode (int scaleMode)

Selects whether the image will fill the paper and be cropped SCALE_MODE_FIT or whether the image will be scaled but leave white space SCALE_MODE_FILL.

Parameters
scaleMode SCALE_MODE_FIT or SCALE_MODE_FILL