Class PDPixelMap
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject
-
- org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
-
- org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap
-
- All Implemented Interfaces:
COSObjectable
public class PDPixelMap extends PDXObjectImage
This class contains a PixelMap Image.- Version:
- $Revision: 1.10 $
- Author:
- Ben Litchfield, mathiak
-
-
Field Summary
-
Fields inherited from class org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
SUB_TYPE
-
-
Constructor Summary
Constructors Constructor Description PDPixelMap(PDStream pdStream)
Standard constructor.PDPixelMap(PDDocument doc, java.awt.image.BufferedImage bi)
Construct a pixel map image from an AWT image.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear()
Calling this will release all cached information.COSDictionary
getDecodeParams()
Deprecated.UsePDStream.getDecodeParms()
insteadint
getPredictor()
Deprecated.seeFlateFilter
java.awt.image.BufferedImage
getRGBImage()
Returns aBufferedImage
of the COSStream set in the constructor or null if the COSStream could not be encoded.void
write2OutputStream(java.io.OutputStream out)
Writes the image as .png.-
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
applyMasks, createThumbnailXObject, getBitsPerComponent, getColorSpace, getDecode, getHeight, getImageMask, getMask, getSMaskImage, getStencilColor, getSuffix, getWidth, hasMask, imageMask, mask, setBitsPerComponent, setColorSpace, setHeight, setStencilColor, setWidth, write2file, write2file
-
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject
commonXObjectCreation, createXObject, getCOSObject, getCOSStream, getMetadata, getPDStream, getStructParent, setMetadata, setStructParent
-
-
-
-
Constructor Detail
-
PDPixelMap
public PDPixelMap(PDStream pdStream)
Standard constructor. Basically does nothing.- Parameters:
pdStream
- The stream that holds the pixel map.
-
PDPixelMap
public PDPixelMap(PDDocument doc, java.awt.image.BufferedImage bi) throws java.io.IOException
Construct a pixel map image from an AWT image.- Parameters:
doc
- The PDF document to embed the image in.bi
- The image to read data from.- Throws:
java.io.IOException
- If there is an error while embedding this image.
-
-
Method Detail
-
getRGBImage
public java.awt.image.BufferedImage getRGBImage() throws java.io.IOException
Returns aBufferedImage
of the COSStream set in the constructor or null if the COSStream could not be encoded.- Specified by:
getRGBImage
in classPDXObjectImage
- Returns:
- This PDF object as an AWT image.
- Throws:
java.io.IOException
- If there is an error creating the image.
-
write2OutputStream
public void write2OutputStream(java.io.OutputStream out) throws java.io.IOException
Writes the image as .png. Writes the Image to out.- Specified by:
write2OutputStream
in classPDXObjectImage
- Parameters:
out
- the OutputStream that the Image is written to.- Throws:
java.io.IOException
- when somethings wrong with out
-
getDecodeParams
public COSDictionary getDecodeParams()
Deprecated.UsePDStream.getDecodeParms()
insteadDecodeParms is an optional parameter for filters. It is provided if any of the filters has nondefault parameters. If there is only one filter it is a dictionary, if there are multiple filters it is an array with an entry for each filter. An array entry can hold a null value if only the default values are used or a dictionary with parameters.- Returns:
- The decoding parameters.
-
getPredictor
public int getPredictor()
Deprecated.seeFlateFilter
A code that selects the predictor algorithm.- 1 No prediction (the default value)
- 2 TIFF Predictor 2
- 10 PNG prediction (on encoding, PNG None on all rows)
- 11 PNG prediction (on encoding, PNG Sub on all rows)
- 12 PNG prediction (on encoding, PNG Up on all rows)
- 13 PNG prediction (on encoding, PNG Average on all rows)
- 14 PNG prediction (on encoding, PNG Path on all rows)
- 15 PNG prediction (on encoding, PNG optimum)
- Returns:
- predictor algorithm code
-
-