Class JPEGFactory
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.graphics.image.JPEGFactory
-
public final class JPEGFactory extends Object
Factory for creating a PDImageXObject containing a JPEG compressed image.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PDImageXObjectcreateFromImage(PDDocument document, android.graphics.Bitmap image)Creates a new JPEG Image XObject from a Buffered Image.static PDImageXObjectcreateFromImage(PDDocument document, android.graphics.Bitmap image, float quality)Creates a new JPEG Image XObject from a Buffered Image and a given quality.static PDImageXObjectcreateFromImage(PDDocument document, android.graphics.Bitmap image, float quality, int dpi)Creates a new JPEG Image XObject from a Buffered Image, a given quality and DPI.static PDImageXObjectcreateFromStream(PDDocument document, InputStream stream)Creates a new JPEG Image XObject from an input stream containing JPEG data.
-
-
-
Method Detail
-
createFromStream
public static PDImageXObject createFromStream(PDDocument document, InputStream stream) throws IOException
Creates a new JPEG Image XObject from an input stream containing JPEG data. The input stream data will be preserved and embedded in the PDF file without modification.- Parameters:
document- the document where the image will be createdstream- a stream of JPEG data- Returns:
- a new Image XObject
- Throws:
IOException- if the input stream cannot be read
-
createFromImage
public static PDImageXObject createFromImage(PDDocument document, android.graphics.Bitmap image) throws IOException
Creates a new JPEG Image XObject from a Buffered Image.- Parameters:
document- the document where the image will be createdimage- the buffered image to embed- Returns:
- a new Image XObject
- Throws:
IOException- if the JPEG data cannot be written
-
createFromImage
public static PDImageXObject createFromImage(PDDocument document, android.graphics.Bitmap image, float quality) throws IOException
Creates a new JPEG Image XObject from a Buffered Image and a given quality. The image will be created at 72 DPI.- Parameters:
document- the document where the image will be createdimage- the buffered image to embedquality- the desired JPEG compression quality- Returns:
- a new Image XObject
- Throws:
IOException- if the JPEG data cannot be written
-
createFromImage
public static PDImageXObject createFromImage(PDDocument document, android.graphics.Bitmap image, float quality, int dpi) throws IOException
Creates a new JPEG Image XObject from a Buffered Image, a given quality and DPI.- Parameters:
document- the document where the image will be createdimage- the buffered image to embedquality- the desired JPEG compression qualitydpi- the desired DPI (resolution) of the JPEG- Returns:
- a new Image XObject
- Throws:
IOException- if the JPEG data cannot be written
-
-