public final class LosslessFactory
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
LosslessFactory.PredictorEncoder |
Modifier and Type | Field and Description |
---|---|
(package private) static boolean |
usePredictorEncoder
Internal, only for benchmark purpose
|
Modifier | Constructor and Description |
---|---|
private |
LosslessFactory() |
Modifier and Type | Method and Description |
---|---|
private static PDImageXObject |
createFromGrayImage(java.awt.image.BufferedImage image,
PDDocument document) |
static PDImageXObject |
createFromImage(PDDocument document,
java.awt.image.BufferedImage image)
Creates a new lossless encoded image XObject from a BufferedImage.
|
private static PDImageXObject |
createFromRGBImage(java.awt.image.BufferedImage image,
PDDocument document) |
private static boolean |
isGrayImage(java.awt.image.BufferedImage image) |
(package private) static PDImageXObject |
prepareImageXObject(PDDocument document,
byte[] byteArray,
int width,
int height,
int bitsPerComponent,
PDColorSpace initColorSpace)
Create a PDImageXObject using the Flate filter.
|
static boolean usePredictorEncoder
public static PDImageXObject createFromImage(PDDocument document, java.awt.image.BufferedImage image) throws java.io.IOException
New for advanced users from 2.0.12 on:
If you created your image with a non standard ICC colorspace, it will be
preserved. (If you load images in java using ImageIO then no need to read
this segment) However a new colorspace will be created for each image. So
if you create a PDF with several such images, consider replacing the
colorspace with a common object to save space. This is done with
PDImageXObject.getColorSpace()
and
PDImageXObject.setColorSpace()
document
- the document where the image will be createdimage
- the BufferedImage to embedjava.io.IOException
- if something goes wrongprivate static boolean isGrayImage(java.awt.image.BufferedImage image)
private static PDImageXObject createFromGrayImage(java.awt.image.BufferedImage image, PDDocument document) throws java.io.IOException
java.io.IOException
private static PDImageXObject createFromRGBImage(java.awt.image.BufferedImage image, PDDocument document) throws java.io.IOException
java.io.IOException
static PDImageXObject prepareImageXObject(PDDocument document, byte[] byteArray, int width, int height, int bitsPerComponent, PDColorSpace initColorSpace) throws java.io.IOException
document
- The document.byteArray
- array with data.width
- the image widthheight
- the image heightbitsPerComponent
- the bits per componentinitColorSpace
- the color spacejava.io.IOException