Class CCITTFactory
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.graphics.image.CCITTFactory
-
public final class CCITTFactory extends Object
Factory for creating a PDImageXObject containing a CCITT Fax compressed TIFF image.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static PDImageXObjectcreateFromByteArray(PDDocument document, byte[] byteArray)Creates a new CCITT Fax compressed image XObject from a specific image of a TIFF file stored in a byte array.static PDImageXObjectcreateFromByteArray(PDDocument document, byte[] byteArray, int number)Creates a new CCITT Fax compressed image XObject from a specific image of a TIFF file stored in a byte array.static PDImageXObjectcreateFromFile(PDDocument document, File file)Creates a new CCITT Fax compressed image XObject from the first image of a TIFF file.static PDImageXObjectcreateFromFile(PDDocument document, File file, int number)Creates a new CCITT Fax compressed image XObject from a specific image of a TIFF file.static PDImageXObjectcreateFromImage(PDDocument document, Bitmap image)Creates a new CCITT group 4 (T6) compressed image XObject from a b/w Bitmap.static PDImageXObjectcreateFromRandomAccess(PDDocument document, RandomAccess reader)Deprecated.UsecreateFromFile(PDDocument, File)instead.static PDImageXObjectcreateFromRandomAccess(PDDocument document, RandomAccess reader, int number)Deprecated.UsecreateFromFile(PDDocument, File, int)instead.
-
-
-
Method Detail
-
createFromImage
public static PDImageXObject createFromImage(PDDocument document, Bitmap image) throws IOException
Creates a new CCITT group 4 (T6) compressed image XObject from a b/w Bitmap. This compression technique usually results in smaller images than those produced byLosslessFactory.createFromImage(PDDocument, Bitmap).- Parameters:
document- the document to create the image as part of.image- the image.- Returns:
- a new image XObject.
- Throws:
IOException- if there is an error creating the image.IllegalArgumentException- if the Bitmap is not a b/w image.
-
createFromByteArray
public static PDImageXObject createFromByteArray(PDDocument document, byte[] byteArray) throws IOException
Creates a new CCITT Fax compressed image XObject from a specific image of a TIFF file stored in a byte array. Only single-strip CCITT T4 or T6 compressed TIFF files are supported. If you're not sure what TIFF files you have, useLosslessFactory.createFromImage(PDDocument, Bitmap)orcreateFromImage(PDDocument, Bitmap)instead.- Parameters:
document- the document to create the image as part of.byteArray- the TIFF file in a byte array which contains a suitable CCITT compressed image- Returns:
- a new Image XObject
- Throws:
IOException- if there is an error reading the TIFF data.
-
createFromByteArray
public static PDImageXObject createFromByteArray(PDDocument document, byte[] byteArray, int number) throws IOException
Creates a new CCITT Fax compressed image XObject from a specific image of a TIFF file stored in a byte array. Only single-strip CCITT T4 or T6 compressed TIFF files are supported. If you're not sure what TIFF files you have, useLosslessFactory.createFromImage(PDDocument, Bitmap)orcreateFromImage(PDDocument, Bitmap)instead.- Parameters:
document- the document to create the image as part of.byteArray- the TIFF file in a byte array which contains a suitable CCITT compressed imagenumber- TIFF image number, starting from 0- Returns:
- a new Image XObject
- Throws:
IOException- if there is an error reading the TIFF data.
-
createFromRandomAccess
@Deprecated public static PDImageXObject createFromRandomAccess(PDDocument document, RandomAccess reader) throws IOException
Deprecated.UsecreateFromFile(PDDocument, File)instead.Creates a new CCITT Fax compressed image XObject from the first image of a TIFF file.- Parameters:
document- the document to create the image as part of.reader- the random access TIFF file which contains a suitable CCITT compressed image- Returns:
- a new image XObject
- Throws:
IOException- if there is an error reading the TIFF data.
-
createFromRandomAccess
@Deprecated public static PDImageXObject createFromRandomAccess(PDDocument document, RandomAccess reader, int number) throws IOException
Deprecated.UsecreateFromFile(PDDocument, File, int)instead.Creates a new CCITT Fax compressed image XObject from a specific image of a TIFF file.- Parameters:
document- the document to create the image as part of.reader- the random access TIFF file which contains a suitable CCITT compressed imagenumber- TIFF image number, starting from 0- Returns:
- a new image XObject, or null if no such page
- Throws:
IOException- if there is an error reading the TIFF data.
-
createFromFile
public static PDImageXObject createFromFile(PDDocument document, File file) throws IOException
Creates a new CCITT Fax compressed image XObject from the first image of a TIFF file. Only single-strip CCITT T4 or T6 compressed TIFF files are supported. If you're not sure what TIFF files you have, useLosslessFactory.createFromImage(com.tom_roush.pdfbox.pdmodel.PDDocument, android.graphics.Bitmap)orcreateFromImage(PDDocument, Bitmap)instead.- Parameters:
document- the document to create the image as part of.file- the TIFF file which contains a suitable CCITT compressed image- Returns:
- a new Image XObject
- Throws:
IOException- if there is an error reading the TIFF data.
-
createFromFile
public static PDImageXObject createFromFile(PDDocument document, File file, int number) throws IOException
Creates a new CCITT Fax compressed image XObject from a specific image of a TIFF file. Only single-strip CCITT T4 or T6 compressed TIFF files are supported. If you're not sure what TIFF files you have, useLosslessFactory.createFromImage(PDDocument, Bitmap)orcreateFromImage(PDDocument, Bitmap)instead.- Parameters:
document- the document to create the image as part of.file- the TIFF file which contains a suitable CCITT compressed imagenumber- TIFF image number, starting from 0- Returns:
- a new Image XObject
- Throws:
IOException- if there is an error reading the TIFF data.
-
-