/** * Associates the specified <CODE>PdfObject</CODE> as <VAR>value</VAR> with * the specified <CODE>PdfName</CODE> as <VAR>key</VAR> in this map. * * If the map previously contained a mapping for this <VAR>key</VAR>, the * old <VAR>value</VAR> is replaced. If the <VAR>value</VAR> is * <CODE>null</CODE> or <CODE>PdfNull</CODE> the key is deleted. * * @param key a <CODE>PdfName</CODE> * @param object the <CODE>PdfObject</CODE> to be associated with the * <VAR>key</VAR> */ public void put(final PdfName key, final PdfObject object) { if (object == null || object.isNull()) hashMap.remove(key); else hashMap.put(key, object); }
/** * Associates the specified <CODE>PdfObject</CODE> as <VAR>value</VAR> with * the specified <CODE>PdfName</CODE> as <VAR>key</VAR> in this map. * * If the map previously contained a mapping for this <VAR>key</VAR>, the * old <VAR>value</VAR> is replaced. If the <VAR>value</VAR> is * <CODE>null</CODE> or <CODE>PdfNull</CODE> the key is deleted. * * @param key a <CODE>PdfName</CODE> * @param object the <CODE>PdfObject</CODE> to be associated with the * <VAR>key</VAR> */ public void put(final PdfName key, final PdfObject object) { if (key == null) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("key.is.null")); if (object == null || object.isNull()) hashMap.remove(key); else hashMap.put(key, object); }
void addDefaultColor(PdfName name, PdfObject obj) { if (obj == null || obj.isNull()) colorDictionary.remove(name); else colorDictionary.put(name, obj); }
void addDefaultColor(PdfName name, PdfObject obj) { if (obj == null || obj.isNull()) colorDictionary.remove(name); else colorDictionary.put(name, obj); }
/** * Use this method to sets the default colorspace that will be applied * to all the document. The colorspace is only applied if another colorspace * with the same name is not present in the content. * <p> * The colorspace is applied immediately when creating templates and * at the page end for the main document content. * @param key the name of the colorspace. It can be <CODE>PdfName.DEFAULTGRAY</CODE>, <CODE>PdfName.DEFAULTRGB</CODE> * or <CODE>PdfName.DEFAULTCMYK</CODE> * @param cs the colorspace. A <CODE>null</CODE> or <CODE>PdfNull</CODE> removes any colorspace with the same name */ public void setDefaultColorspace(final PdfName key, final PdfObject cs) { if (cs == null || cs.isNull()) defaultColorspace.remove(key); defaultColorspace.put(key, cs); }
/** * Use this method to sets the default colorspace that will be applied * to all the document. The colorspace is only applied if another colorspace * with the same name is not present in the content. * <p> * The colorspace is applied immediately when creating templates and * at the page end for the main document content. * @param key the name of the colorspace. It can be <CODE>PdfName.DEFAULTGRAY</CODE>, <CODE>PdfName.DEFAULTRGB</CODE> * or <CODE>PdfName.DEFAULTCMYK</CODE> * @param cs the colorspace. A <CODE>null</CODE> or <CODE>PdfNull</CODE> removes any colorspace with the same name */ public void setDefaultColorspace(final PdfName key, final PdfObject cs) { if (cs == null || cs.isNull()) defaultColorspace.remove(key); defaultColorspace.put(key, cs); }
/** * Eliminates the reference to the object freeing the memory used by it and clearing * the xref entry. * @param obj the object. If it's an indirect reference it will be eliminated * @return the object or the already erased dereferenced object */ public static PdfObject killIndirect(final PdfObject obj) { if (obj == null || obj.isNull()) return null; PdfObject ret = getPdfObjectRelease(obj); if (obj.isIndirect()) { PRIndirectReference ref = (PRIndirectReference)obj; PdfReader reader = ref.getReader(); int n = ref.getNumber(); reader.xrefObj.set(n, null); if (reader.partial) reader.xref[n * 2] = -1; } return ret; }
/** * Eliminates the reference to the object freeing the memory used by it and clearing * the xref entry. * @param obj the object. If it's an indirect reference it will be eliminated * @return the object or the already erased dereferenced object */ public static PdfObject killIndirect(final PdfObject obj) { if (obj == null || obj.isNull()) return null; PdfObject ret = getPdfObjectRelease(obj); if (obj.isIndirect()) { PRIndirectReference ref = (PRIndirectReference)obj; PdfReader reader = ref.getReader(); int n = ref.getNumber(); reader.xrefObj.set(n, null); if (reader.partial) reader.xref[n * 2] = -1; } return ret; }
if ((tagged || mergeFields) && indirectObjects != null && (object.isArray() || object.isDictionary() || object.isStream() || object.isNull())) { RefKey key = new RefKey(ref); PdfIndirectObject obj = indirectObjects.get(key);
if ((tagged || mergeFields) && indirectObjects != null && (object.isArray() || object.isDictionary() || object.isStream() || object.isNull())) { RefKey key = new RefKey(ref); PdfIndirectObject obj = indirectObjects.get(key);
} else if (value1.isNull()) { if (value1 == value2) return true;
} else if (value1.isNull()) { if (value1 == value2) return true;
PdfObject firstNotNullKid = null; for (PdfObject numObj: (PdfArray)obj){ if (numObj.isNull()) { if (nullReference == null) nullReference = writer.addToBody(new PdfNull()).getIndirectReference();
PdfObject firstNotNullKid = null; for (PdfObject numObj: (PdfArray)obj){ if (numObj.isNull()) { if (nullReference == null) nullReference = writer.addToBody(new PdfNull()).getIndirectReference();