*
* @throws IOException If there is an error getting the colorspace.
*/
public PDColorSpace getColorSpace() throws IOException
{
COSBase cs = getCOSStream().getDictionaryObject( new String[]{ "CS", "ColorSpace" } );
PDColorSpace retval = null;
if( cs != null )
{
retval = PDColorSpaceFactory.createColorSpace( cs );
}
else
{
//there are some cases where the 'required' CS value is not present
//but we know that it will be grayscale for a CCITT filter.
COSBase filter = getCOSStream().getDictionaryObject( "Filter" );
if( COSName.CCITTFAX_DECODE.equals( filter ) ||
COSName.CCITTFAX_DECODE_ABBREVIATION.equals( filter ) )
{
retval = new PDDeviceGray();
}