/** * 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; }
/** * 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; }
/** * 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; }
public void transformDestination(float a, float b, float c, float d, float e, float f) { if (!isInternal()) throw new IllegalArgumentException("Cannot change destination of external link"); if (destination.getAsName(1).equals(PdfName.XYZ)) { float x = destination.getAsNumber(2).floatValue(); float y = destination.getAsNumber(3).floatValue(); float xx = x * a + y * c + e; float yy = x * b + y * d + f; destination.set(2, new PdfNumber(xx)); destination.set(3, new PdfNumber(yy)); } }
public void transformDestination(float a, float b, float c, float d, float e, float f) { if (!isInternal()) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("cannot.change.destination.of.external.link")); if (destination.getAsName(1).equals(PdfName.XYZ)) { float x = destination.getAsNumber(2).floatValue(); float y = destination.getAsNumber(3).floatValue(); float xx = x * a + y * c + e; float yy = x * b + y * d + f; destination.set(2, new PdfNumber(xx)); destination.set(3, new PdfNumber(yy)); } }
public void transformDestination(float a, float b, float c, float d, float e, float f) { if (!isInternal()) { throw new IllegalArgumentException(MessageLocalization.getComposedMessage("cannot.change.destination.of.external.link")); } if (destination.getAsName(1).equals(PdfName.XYZ)) { float x = destination.getAsNumber(2).floatValue(); float y = destination.getAsNumber(3).floatValue(); float xx = x * a + y * c + e; float yy = x * b + y * d + f; destination.set(2, new PdfNumber(xx)); destination.set(3, new PdfNumber(yy)); } }
/** * 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); }
/** * 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); }
/** * 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); }
PdfArray ar = (PdfArray)value; if (ar.size() == 4 && PdfName.INDEXED.equals(ar.getAsName(0)) && ar.getPdfObject(1).isName() && ar.getPdfObject(2).isNumber()
PdfArray ar = (PdfArray)value; if (ar.size() == 4 && PdfName.INDEXED.equals(ar.getAsName(0)) && ar.getPdfObject(1).isName() && ar.getPdfObject(2).isNumber()
PdfArray ar = (PdfArray)value; if (ar.size() == 4 && PdfName.INDEXED.equals(ar.getAsName(0)) && ar.getPdfObject(1).isName() && ar.getPdfObject(2).isNumber()