org.pdfbox.pdmodel.graphics.xobject
Class PDXObjectImage
- COSObjectable
public abstract class PDXObjectImage
The prototype for all PDImages.
static String | SUB_TYPE - The XObject subtype.
|
int | getBitsPerComponent() - The bits per component of this image.
|
PDColorSpace | getColorSpace() - This will get the color space or null if none exists.
|
int | getHeight() - Get the height of the image.
|
abstract BufferedImage | getRGBImage() - Returns an java.awt.Image, that can be used for display etc.
|
String | getSuffix() - This will get the suffix for this image type, jpg/png.
|
int | getWidth() - Get the width of the image.
|
void | setBitsPerComponent(int bpc) - Set the number of bits per component.
|
void | setColorSpace(PDColorSpace cs) - This will set the color space for this image.
|
void | setHeight(int height) - Set the height of the image.
|
void | setWidth(int width) - Set the width of the image.
|
abstract void | write2OutputStream(OutputStream out) - Writes the Image to out.
|
void | write2file(String filename) - Writes the image to a file with the filename + an appropriate suffix, like "Image.jpg".
|
SUB_TYPE
public static final String SUB_TYPE
The XObject subtype.
PDXObjectImage
public PDXObjectImage(PDDocument doc,
String fileSuffix)
Standard constuctor.
doc
- The document to store the stream in.fileSuffix
- The file suffix, jpg/png.
PDXObjectImage
public PDXObjectImage(PDStream imageStream,
String fileSuffix)
Standard constuctor.
imageStream
- The XObject is passed as a COSStream.fileSuffix
- The file suffix, jpg/png.
getBitsPerComponent
public int getBitsPerComponent()
The bits per component of this image. This will return -1 if one has not
been set.
- The number of bits per component.
getColorSpace
public PDColorSpace getColorSpace()
throws IOException
This will get the color space or null if none exists.
- The color space for this image.
getHeight
public int getHeight()
Get the height of the image.
getRGBImage
public abstract BufferedImage getRGBImage()
throws IOException
Returns an java.awt.Image, that can be used for display etc.
- This PDF object as an AWT image.
getSuffix
public String getSuffix()
This will get the suffix for this image type, jpg/png.
getWidth
public int getWidth()
Get the width of the image.
setBitsPerComponent
public void setBitsPerComponent(int bpc)
Set the number of bits per component.
bpc
- The number of bits per component.
setColorSpace
public void setColorSpace(PDColorSpace cs)
This will set the color space for this image.
cs
- The color space for this image.
setHeight
public void setHeight(int height)
Set the height of the image.
height
- The height of the image.
setWidth
public void setWidth(int width)
Set the width of the image.
width
- The width of the image.
write2OutputStream
public abstract void write2OutputStream(OutputStream out)
throws IOException
Writes the Image to out.
out
- the OutputStream that the Image is written to.
write2file
public void write2file(String filename)
throws IOException
Writes the image to a file with the filename + an appropriate suffix, like "Image.jpg".
The suffix is automatically set by the