Class PDJpeg
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject
org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg
- All Implemented Interfaces:
COSObjectable
An image class for JPegs.
- Author:
- mathiak
-
Field Summary
Fields inherited from class org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
SUB_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionStandard constructor.PDJpeg(PDDocument doc, BufferedImage bi) Construct from a buffered image.PDJpeg(PDDocument doc, BufferedImage bi, float compressionQuality) Construct from a buffered image.PDJpeg(PDDocument doc, InputStream is) Construct from a stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Calling this will release all cached information.Returns an image of the JPeg, or null if JPegs are not supported.voidThis writes the JPeg to out.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, write2fileMethods inherited from class org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject
commonXObjectCreation, createXObject, getCOSObject, getCOSStream, getMetadata, getPDStream, getStructParent, setMetadata, setStructParent
-
Constructor Details
-
PDJpeg
Standard constructor.- Parameters:
jpeg- The COSStream from which to extract the JPeg
-
PDJpeg
Construct from a stream.- Parameters:
doc- The document to create the image as part of.is- The stream that contains the jpeg data.- Throws:
IOException- If there is an error reading the jpeg data.
-
PDJpeg
Construct from a buffered image. The default compression level of 0.75 will be used.- Parameters:
doc- The document to create the image as part of.bi- The image to convert to a jpeg- Throws:
IOException- If there is an error processing the jpeg data.
-
PDJpeg
Construct from a buffered image.- Parameters:
doc- The document to create the image as part of.bi- The image to convert to a jpegcompressionQuality- The desired JPEG compression quality; between 0 (best compression) and 1 (best image quality). SeeImageWriteParam.setCompressionQuality(float)for more details.- Throws:
IOException- If there is an error processing the jpeg data.
-
-
Method Details
-
getRGBImage
Returns an image of the JPeg, or null if JPegs are not supported. (They should be. ) Returns an java.awt.Image, that can be used for display etc.- Specified by:
getRGBImagein classPDXObjectImage- Returns:
- A Jpeg image.
- Throws:
IOException
-
write2OutputStream
This writes the JPeg to out. Writes the Image to out.- Specified by:
write2OutputStreamin classPDXObjectImage- Parameters:
out- the OutputStream that the Image is written to.- Throws:
IOException- when somethings wrong with out
-
clear
public void clear()Description copied from class:PDXObjectCalling this will release all cached information.
-