PDColorSpace initColorSpace) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Filter filter = FilterFactory.INSTANCE.getFilter(COSName.FLATE_DECODE);
filter.encode(new ByteArrayInputStream(byteArray), baos, new COSDictionary(), 0);
ByteArrayInputStream filteredByteStream = new ByteArrayInputStream(baos.toByteArray());
return new PDImageXObject(document, filteredByteStream, COSName.FLATE_DECODE,
width, height, bitsPerComponent, initColorSpace);
}