示例#1
0
        internal void RemoveField(PDFDictionary dict)
        {
            PDFDictionary parent = dict["Parent"] as PDFDictionary;

            if (parent != null)
            {
                PDFArray kids = parent["Kids"] as PDFArray;
                if (kids != null)
                {
                    for (int i = 0; i < kids.Count; ++i)
                    {
                        if (kids[i] == dict)
                        {
                            kids.RemoveItem(i);
                            break;
                        }
                    }

                    if (kids.Count == 0)
                    {
                        RemoveField(parent);
                    }
                    return;
                }
            }

            PDFArray fields = _dictionary["Fields"] as PDFArray;

            for (int i = 0; i < fields.Count; ++i)
            {
                if (fields[i] == dict)
                {
                    fields.RemoveItem(i);
                    return;
                }
            }
        }