Java Code Examples for com.lowagie.text.pdf.PdfArray#getAsArray()
The following examples show how to use
com.lowagie.text.pdf.PdfArray#getAsArray() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Image.java From itext2 with GNU Lesser General Public License v3.0 | 6 votes |
/** * Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray. */ public void simplifyColorspace() { if (additional == null) return; PdfArray value = additional.getAsArray(PdfName.COLORSPACE); if (value == null) return; PdfObject cs = simplifyColorspace(value); PdfObject newValue; if (cs.isName()) newValue = cs; else { newValue = value; PdfName first = value.getAsName(0); if (PdfName.INDEXED.equals(first)) { if (value.size() >= 2) { PdfArray second = value.getAsArray(1); if (second != null) { value.set(1, simplifyColorspace(second)); } } } } additional.put(PdfName.COLORSPACE, newValue); }
Example 2
Source File: Image.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray. */ public void simplifyColorspace() { if (additional == null) { return; } PdfArray value = additional.getAsArray(PdfName.COLORSPACE); if (value == null) { return; } PdfObject cs = simplifyColorspace(value); PdfObject newValue; if (cs.isName()) { newValue = cs; } else { newValue = value; PdfName first = value.getAsName(0); if (PdfName.INDEXED.equals(first)) { if (value.size() >= 2) { PdfArray second = value.getAsArray(1); if (second != null) { value.set(1, simplifyColorspace(second)); } } } } additional.put(PdfName.COLORSPACE, newValue); }