public final class JPEGFactory extends Object
| Modifier and Type | Method and Description |
|---|---|
static PDImageXObject |
createFromByteArray(PDDocument document,
byte[] byteArray)
Creates a new JPEG Image XObject from a byte array containing JPEG data.
|
static PDImageXObject |
createFromImage(PDDocument document,
BufferedImage image)
Creates a new JPEG PDImageXObject from a BufferedImage.
|
static PDImageXObject |
createFromImage(PDDocument document,
BufferedImage image,
float quality)
Creates a new JPEG PDImageXObject from a BufferedImage and a given quality.
|
static PDImageXObject |
createFromImage(PDDocument document,
BufferedImage image,
float quality,
int dpi)
Creates a new JPEG Image XObject from a BufferedImage, a given quality and DPI.
|
static PDImageXObject |
createFromStream(PDDocument document,
InputStream stream)
Creates a new JPEG Image XObject from an input stream containing JPEG data.
|
public static PDImageXObject createFromStream(PDDocument document, InputStream stream) throws IOException
document - the document where the image will be createdstream - a stream of JPEG dataIOException - if the input stream cannot be readpublic static PDImageXObject createFromByteArray(PDDocument document, byte[] byteArray) throws IOException
document - the document where the image will be createdbyteArray - bytes of JPEG imageIOException - if the input stream cannot be readpublic static PDImageXObject createFromImage(PDDocument document, BufferedImage image) throws IOException
Do not read a JPEG image from a stream/file and call this method; you'll get more speed and
quality by calling createFromStream() instead.
document - the document where the image will be createdimage - the BufferedImage to embedIOException - if the JPEG data cannot be writtenpublic static PDImageXObject createFromImage(PDDocument document, BufferedImage image, float quality) throws IOException
Do not read a JPEG image from a stream/file and call this method; you'll get more speed and
quality by calling createFromStream() instead.
The image will be created at 72 DPI.
document - the document where the image will be createdimage - the BufferedImage to embedquality - the desired JPEG compression qualityIOException - if the JPEG data cannot be writtenpublic static PDImageXObject createFromImage(PDDocument document, BufferedImage image, float quality, int dpi) throws IOException
Do not read a JPEG image from a stream/file and call this method; you'll get more speed and
quality by calling createFromStream() instead.
document - the document where the image will be createdimage - the BufferedImage to embedquality - the desired JPEG compression qualitydpi - the desired DPI (resolution) of the JPEGIOException - if the JPEG data cannot be writtenCopyright © 2002–2017 The Apache Software Foundation. All rights reserved.