Example #1
0
        internal Page Clone(IDocumentEssential owner)
        {
            if (_owner == null)
            {
                _owner = owner;
                if (_onClosed != null)
                {
                    _onClosed.ApplyOwner(owner);
                }
                if (_onOpened != null)
                {
                    _onOpened.ApplyOwner(owner);
                }

                if (_dictionary["Annots"] as PDFArray != null)
                {
                    for (int i = 0; i < Annotations.Count; ++i)
                    {
                        Annotations[i].ApplyOwner(owner);
                        if (Annotations[i] is Field)
                        {
                            _owner.AddField(Annotations[i] as Field);
                        }
                    }
                }

                return(this);
            }

            PDFDictionary pageDictionary = PageBase.Copy(GetDictionary());
            Page          page           = new Page(pageDictionary, owner);

            if (_dictionary["Annots"] as PDFArray != null)
            {
                page.Annotations = Annotations.Clone(owner, this);
            }

            if (OnClosed != null)
            {
                page.OnClosed = OnClosed;
            }
            if (OnOpened != null)
            {
                page.OnOpened = OnOpened;
            }

            page._id = _id;
            return(page);
        }