Java Code Examples for com.lowagie.text.pdf.PdfArray#getAsName()
The following examples show how to use
com.lowagie.text.pdf.PdfArray#getAsName() .
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); }
Example 3
Source File: Image.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * Gets a PDF Name from an array or returns the object that was passed. */ private PdfObject simplifyColorspace(PdfArray obj) { if (obj == null) { return obj; } PdfName first = obj.getAsName(0); if (PdfName.CALGRAY.equals(first)) { return PdfName.DEVICEGRAY; } else if (PdfName.CALRGB.equals(first)) { return PdfName.DEVICERGB; } else { return obj; } }
Example 4
Source File: Image.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** * Gets a PDF Name from an array or returns the object that was passed. */ private PdfObject simplifyColorspace(PdfArray obj) { if (obj == null) return obj; PdfName first = obj.getAsName(0); if (PdfName.CALGRAY.equals(first)) return PdfName.DEVICEGRAY; else if (PdfName.CALRGB.equals(first)) return PdfName.DEVICERGB; else return obj; }