protected internal override void CopyContent(PdfObject from, PdfDocument document) { base.CopyContent(from, document); iText.Kernel.Pdf.PdfDictionary dictionary = (iText.Kernel.Pdf.PdfDictionary)from; foreach (KeyValuePair <PdfName, PdfObject> entry in dictionary.map) { map.Put(entry.Key, entry.Value.ProcessCopying(document, false)); } }
/// <summary>This method merges different fields from two dictionaries into the current one</summary> /// <param name="other">a dictionary whose fields should be merged into the current dictionary.</param> public virtual void MergeDifferent(iText.Kernel.Pdf.PdfDictionary other) { foreach (PdfName key in other.KeySet()) { if (!ContainsKey(key)) { Put(key, other.Get(key)); } } }
/// <summary>Creates clones of the dictionary in the current document.</summary> /// <remarks> /// Creates clones of the dictionary in the current document. /// It's possible to pass a list of keys to exclude when cloning. /// </remarks> /// <param name="excludeKeys">list of objects to exclude when cloning dictionary.</param> /// <returns>cloned dictionary.</returns> public virtual iText.Kernel.Pdf.PdfDictionary Clone(IList <PdfName> excludeKeys) { IDictionary <PdfName, PdfObject> excluded = new SortedDictionary <PdfName, PdfObject>(); foreach (PdfName key in excludeKeys) { PdfObject obj = map.Get(key); if (obj != null) { excluded.Put(key, map.JRemove(key)); } } iText.Kernel.Pdf.PdfDictionary dictionary = (iText.Kernel.Pdf.PdfDictionary)Clone(); map.AddAll(excluded); return(dictionary); }
/// <summary>Copies dictionary to specified document.</summary> /// <remarks> /// Copies dictionary to specified document. /// It's possible to pass a list of keys to exclude when copying. /// </remarks> /// <param name="document">document to copy dictionary to.</param> /// <param name="excludeKeys">list of objects to exclude when copying dictionary.</param> /// <param name="allowDuplicating"> /// /// <see cref="PdfObject.CopyTo(PdfDocument, bool)"/> /// </param> /// <returns>copied dictionary.</returns> public virtual iText.Kernel.Pdf.PdfDictionary CopyTo(PdfDocument document, IList <PdfName> excludeKeys, bool allowDuplicating) { IDictionary <PdfName, PdfObject> excluded = new SortedDictionary <PdfName, PdfObject>(); foreach (PdfName key in excludeKeys) { PdfObject obj = map.Get(key); if (obj != null) { excluded.Put(key, map.JRemove(key)); } } iText.Kernel.Pdf.PdfDictionary dictionary = (iText.Kernel.Pdf.PdfDictionary)CopyTo(document, allowDuplicating ); map.AddAll(excluded); return(dictionary); }
/// <summary>Creates a new PdfDictionary instance.</summary> /// <remarks> /// Creates a new PdfDictionary instance. This constructor inserts the content of the specified PdfDictionary /// into this PdfDictionary instance. /// </remarks> /// <param name="dictionary">PdfDictionary containing values to be inserted into PdfDictionary</param> public PdfDictionary(iText.Kernel.Pdf.PdfDictionary dictionary) { map.AddAll(dictionary.map); }
/// <summary>Inserts all the key-value pairs into this PdfDictionary.</summary> /// <param name="d">PdfDictionary holding the key-value pairs to be copied</param> public virtual void PutAll(iText.Kernel.Pdf.PdfDictionary d) { map.AddAll(d.map); }