Beispiel #1
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                InkList lst = InkList;

                ApplyOwner(owner);
                SetPage(page, true);

                for (int i = 0; i < lst.Count; ++i)
                {
                    PointF[] points = lst[i].ToArray();
                    lst[i].Clear();
                    lst[i].Page = page;
                    lst[i].AddRange(points);
                }
                lst.Page = page;

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            PDFDictionary bs = Dictionary["BS"] as PDFDictionary;

            if (bs != null)
            {
                res.AddItem("BS", AnnotationBorderStyle.Copy(bs));
            }

            PDFArray inkList = Dictionary["InkList"] as PDFArray;

            if (inkList != null)
            {
                PDFArray newInkList = new PDFArray();
                for (int i = 0; i < inkList.Count; ++i)
                {
                    PDFArray points = inkList[i] as PDFArray;
                    if (points != null)
                    {
                        RectangleF oldRect;
                        if (Page == null)
                        {
                            oldRect = new RectangleF();
                        }
                        else
                        {
                            oldRect = Page.PageRect;
                        }

                        newInkList.AddItem(CloneUtility.CopyArrayCoordinates(points, oldRect, page.PageRect, Page == null));
                    }
                }
                res.AddItem("InkList", newInkList);
            }

            InkAnnotation annot = new InkAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }