示例#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);
        }
示例#2
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);
        }