Exemple #1
0
        public override PdfObject Visit(
            PdfArray obj,
            object data
            )
        {
            Filter   cloneFilter = MatchFilter(obj);
            PdfArray clone       = (PdfArray)obj.Clone();

            {
                clone.items = new List <PdfDirectObject>();
                IList <PdfDirectObject> sourceItems = obj.items;
                for (int index = 0, length = sourceItems.Count; index < length; index++)
                {
                    PdfDirectObject sourceItem = sourceItems[index];
                    if (cloneFilter.BeforeClone(this, obj, clone, index, sourceItem))
                    {
                        PdfDirectObject cloneItem;
                        clone.Add(cloneItem = (PdfDirectObject)(sourceItem != null ? sourceItem.Accept(this, null) : null));
                        cloneFilter.AfterClone(this, obj, clone, index, cloneItem);
                    }
                }
            }
            cloneFilter.AfterClone(this, obj, clone);
            return(clone);
        }
Exemple #2
0
            public override void AfterClone(
                Cloner cloner,
                PdfObject source,
                PdfObject clone
                )
            {
                /*
                 * NOTE: Inheritable attributes have to be consolidated into the cloned page dictionary in
                 * order to ensure its consistency.
                 */
                PdfDictionary cloneDictionary  = (PdfDictionary)clone;
                PdfDictionary sourceDictionary = (PdfDictionary)source;

                foreach (PdfName key in Page.InheritableAttributeKeys)
                {
                    if (!sourceDictionary.ContainsKey(key))
                    {
                        PdfDirectObject sourceValue = Page.GetInheritableAttribute(sourceDictionary, key);
                        if (sourceValue != null)
                        {
                            cloneDictionary[key] = (PdfDirectObject)sourceValue.Accept(cloner, null);
                        }
                    }
                }
            }
Exemple #3
0
        public override PdfObject Visit(
            PdfDictionary obj,
            object data
            )
        {
            Filter        cloneFilter = MatchFilter(obj);
            PdfDictionary clone       = (PdfDictionary)obj.Clone();

            {
                clone.entries = new Dictionary <PdfName, PdfDirectObject>();
                foreach (KeyValuePair <PdfName, PdfDirectObject> entry in obj.entries)
                {
                    PdfDirectObject sourceValue = entry.Value;
                    if (cloneFilter.BeforeClone(this, obj, clone, entry.Key, sourceValue))
                    {
                        PdfDirectObject cloneValue;
                        clone[entry.Key] = cloneValue = (PdfDirectObject)(sourceValue != null ? sourceValue.Accept(this, null) : null);
                        cloneFilter.AfterClone(this, obj, clone, entry.Key, cloneValue);
                    }
                }
            }
            cloneFilter.AfterClone(this, obj, clone);
            return(clone);
        }