PngDevice

Inheritance: java.lang.Object, com.aspose.pdf.devices.Device, com.aspose.pdf.devices.PageDevice, com.aspose.pdf.devices.ImageDevice

public final class PngDevice extends ImageDevice

Represents image device that helps to save pdf document pages into png.

Constructors

Constructor Description
PngDevice() Initializes a new instance of the PngDevice class with default resolution.
PngDevice(Resolution resolution) Initializes a new instance of the PngDevice class.
PngDevice(int width, int height, Resolution resolution) Initializes a new instance of the PngDevice class with provided image dimensions and resolution.
PngDevice(PageSize pageSize, Resolution resolution) Initializes a new instance of the PngDevice class with provided page size and resolution.
PngDevice(int width, int height) Initializes a new instance of the PngDevice class with provided image dimensions, default resolution (=150).
PngDevice(PageSize pageSize) Initializes a new instance of the PngDevice class with provided page size, default resolution (=150).

Methods

Method Description
isTransparentBackground() Gets or sets if image has transparent background.
setTransparentBackground(boolean value) Gets or sets if image has transparent background.
processInternal(Page page, System.IO.Stream output) Converts the page into png and saves it in the output stream.
process(Page page, OutputStream output) Converts the page into png and saves it in the output stream.
processToBufferedImage(Page page) Converts the page into BufferedImage.
processToBufferedImageBinarized(Page page, double threshold) Converts the page into BufferedImage with Bradley binarization.

PngDevice()

public PngDevice()

Initializes a new instance of the PngDevice class with default resolution.

PngDevice(Resolution resolution)

public PngDevice(Resolution resolution)

Initializes a new instance of the PngDevice class.

Parameters:

Parameter Type Description
resolution Resolution Resolution for the result image file, see Resolution class.

PngDevice(int width, int height, Resolution resolution)

public PngDevice(int width, int height, Resolution resolution)

Initializes a new instance of the PngDevice class with provided image dimensions and resolution.

Parameters:

Parameter Type Description
width int Image output width.
height int Image output height.
resolution Resolution Resolution for the result image file, see Resolution class.

PngDevice(PageSize pageSize, Resolution resolution)

public PngDevice(PageSize pageSize, Resolution resolution)

Initializes a new instance of the PngDevice class with provided page size and resolution.

Parameters:

Parameter Type Description
pageSize PageSize Page size of the output image.
resolution Resolution Resolution for the result image file, see Resolution class.

PngDevice(int width, int height)

public PngDevice(int width, int height)

Initializes a new instance of the PngDevice class with provided image dimensions, default resolution (=150).

Parameters:

Parameter Type Description
width int Image output width.
height int Image output height.

PngDevice(PageSize pageSize)

public PngDevice(PageSize pageSize)

Initializes a new instance of the PngDevice class with provided page size, default resolution (=150).

Parameters:

Parameter Type Description
pageSize PageSize Page size of the output image.

isTransparentBackground()

public final boolean isTransparentBackground()

Gets or sets if image has transparent background.

Returns: boolean - boolean value

setTransparentBackground(boolean value)

public final void setTransparentBackground(boolean value)

Gets or sets if image has transparent background.

Parameters:

Parameter Type Description
value boolean boolean value

processInternal(Page page, System.IO.Stream output)

public void processInternal(Page page, System.IO.Stream output)

Converts the page into png and saves it in the output stream.

Parameters:

Parameter Type Description
page Page The page to convert.
output com.aspose.ms.System.IO.Stream Output stream with png image.

process(Page page, OutputStream output)

public void process(Page page, OutputStream output)

Converts the page into png and saves it in the output stream.

Parameters:

Parameter Type Description
page Page The page to convert.
output java.io.OutputStream Output stream with png image.

processToBufferedImage(Page page)

public BufferedImage processToBufferedImage(Page page)

Converts the page into BufferedImage.

Parameters:

Parameter Type Description
page Page The page to convert.

Returns: java.awt.image.BufferedImage - BufferedImage Output BufferedImage image.

processToBufferedImageBinarized(Page page, double threshold)

public BufferedImage processToBufferedImageBinarized(Page page, double threshold)

Converts the page into BufferedImage with Bradley binarization.

Parameters:

Parameter Type Description
page Page The page to convert.
threshold double The threshold value between 0.0 and 1.0.

Returns: java.awt.image.BufferedImage - BufferedImage Output BufferedImage image.