private PDColorSpace createColorSpace(COSBase cs) throws IOException { if (cs instanceof COSName) { return PDColorSpace.create(toLongName(cs), resources); } if (cs instanceof COSArray && ((COSArray) cs).size() > 1) { COSArray srcArray = (COSArray) cs; COSBase csType = srcArray.get(0); if (COSName.I.equals(csType) || COSName.INDEXED.equals(csType)) { COSArray dstArray = new COSArray(); dstArray.addAll(srcArray); dstArray.set(0, COSName.INDEXED); dstArray.set(1, toLongName(srcArray.get(1))); return PDColorSpace.create(dstArray, resources); } throw new IOException("Illegal type of inline image color space: " + csType); } throw new IOException("Illegal type of object for inline image color space: " + cs); }
private PDColorSpace createColorSpace(COSBase cs) throws IOException { if (cs instanceof COSName) { return PDColorSpace.create(toLongName(cs), resources); } if (cs instanceof COSArray && ((COSArray) cs).size() > 1) { COSArray srcArray = (COSArray) cs; COSBase csType = srcArray.get(0); if (COSName.I.equals(csType) || COSName.INDEXED.equals(csType)) { COSArray dstArray = new COSArray(); dstArray.addAll(srcArray); dstArray.set(0, COSName.INDEXED); dstArray.set(1, toLongName(srcArray.get(1))); return PDColorSpace.create(dstArray, resources); } throw new IOException("Illegal type of inline image color space: " + csType); } throw new IOException("Illegal type of object for inline image color space: " + cs); }
private PDColorSpace createColorSpace(COSBase cs) throws IOException { if (cs instanceof COSName) { return PDColorSpace.create(toLongName(cs), resources); } if (cs instanceof COSArray && ((COSArray) cs).size() > 1) { COSArray srcArray = (COSArray) cs; COSBase csType = srcArray.get(0); if (COSName.I.equals(csType) || COSName.INDEXED.equals(csType)) { COSArray dstArray = new COSArray(); dstArray.addAll(srcArray); dstArray.set(0, COSName.INDEXED); dstArray.set(1, toLongName(srcArray.get(1))); return PDColorSpace.create(dstArray, resources); } throw new IOException("Illegal type of inline image color space: " + csType); } throw new IOException("Illegal type of object for inline image color space: " + cs); }