示例#1
0
        //TODO: Measure

        internal static void CopyTo(PDFDictionary sourceDict, PDFDictionary destinationDict, Page oldPage, Page newPage)
        {
            string[] keys = { "LE", "IC", "BE", "IT" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = sourceDict[keys[i]];
                if (obj != null)
                {
                    destinationDict.AddItem(keys[i], obj.Clone());
                }
            }

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

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

            PDFArray vertices = sourceDict["Vertices"] as PDFArray;

            if (vertices != null)
            {
                RectangleF oldRect = oldPage == null ? new RectangleF() : oldPage.PageRect;

                destinationDict.AddItem("Vertices", CloneUtility.CopyArrayCoordinates(vertices, oldRect, newPage.PageRect, oldPage == null));
            }

            PDFDictionary measure = sourceDict["Measure"] as PDFDictionary;

            if (measure != null)
            {
                destinationDict.AddItem("Measure", Measure.Copy(measure));
            }
        }
示例#2
0
        // TODO:
        //internal PointsArray CoordinatesLines
        //{
        //    get
        //    {
        //        if (m_coordinatesLines == null)
        //        {
        //            PDFArray array = Dictionary["CL"] as PDFArray;
        //            if (array == null)
        //            {
        //                m_coordinatesLines = new PointsArray();
        //                m_coordinatesLines.AddPoint(new PointF(Left, Top + Height / 2));
        //                m_coordinatesLines.AddPoint(new PointF(Left, Top + Height / 2));
        //                Dictionary.AddItem("CL", m_coordinatesLines.Array);
        //            }
        //            else
        //                m_coordinatesLines = new PointsArray(array, Page);
        //        }

        //        return m_coordinatesLines;
        //    }
        //}

        //internal PDFLineEndingStyle EndLineStyle
        //{
        //    get { return TypeConverter.PDFNameToPDFLineEndingStyle(Dictionary["LE"] as PDFName); }
        //    set { Dictionary.AddItem("LE", TypeConverter.PDFLineEndingStyleToPDFName(value)); }
        //}

        //TODO IT

        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            string[] keys = { "DA", "Q", "RC", "DS", "IT", "BE", "RD", "LE" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            PDFArray cl = Dictionary["CL"] as PDFArray;

            if (cl != null)
            {
                RectangleF oldRect;
                if (Page == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = Page.PageRect;
                }

                res.AddItem("CL", CloneUtility.CopyArrayCoordinates(cl, oldRect, page.PageRect, Page == null));
            }

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

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

            FreeTextAnnotation annot = new FreeTextAnnotation(res, owner, false);

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

            annot._font = _font;
            annot._font.ChangedFontSize += annot.changedFontSize;
            annot._fontColor             = _fontColor;
            annot.setTextAttributes();

            return(annot);
        }
示例#3
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);
            IPDFObject    h   = Dictionary["H"];

            if (h != null)
            {
                res.AddItem("H", h.Clone());
            }

            PDFArray quadPoints = Dictionary["QuadPoints"] as PDFArray;

            if (quadPoints != null)
            {
                RectangleF oldRect;
                if (Page == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = Page.PageRect;
                }

                res.AddItem("QuadPoints", CloneUtility.CopyArrayCoordinates(quadPoints, oldRect, page.PageRect, Page == null));
            }

            IPDFObject pa = Dictionary["PA"];

            if (pa != null)
            {
                res.AddItem("PA", pa.Clone());
            }

            LinkAnnotation annot = new LinkAnnotation(res, owner);

            if (_destination != null)
            {
                annot.Destination = Destination;
            }
            if (_action != null)
            {
                annot.Action = _action;
            }

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
示例#4
0
        internal static void CopyTo(PDFDictionary sourceDict, PDFDictionary destinationDict, Page oldPage, Page newPage)
        {
            PDFArray quadPoints = sourceDict["QuadPoints"] as PDFArray;

            if (quadPoints != null)
            {
                RectangleF oldRect;
                if (oldPage == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = oldPage.PageRect;
                }

                destinationDict.AddItem("QuadPoints", CloneUtility.CopyArrayCoordinates(quadPoints, oldRect, newPage.PageRect, oldPage == null));
            }
        }
示例#5
0
        //TODO: Measure
        //TODO: IT

        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                if (_coordinates == null)
                {
                    initCoordinates();
                }

                PointF[] points = _coordinates.ToArray();
                ApplyOwner(owner);
                SetPage(page, true);

                _coordinates.Clear();
                _coordinates.Page = page;
                _coordinates.AddRange(points);

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            string[] keys = { "LE", "IC", "LL", "LLE", "Cap", "IT", "LLO", "CP", "CO" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            PDFArray l = Dictionary["L"] as PDFArray;

            if (l != null)
            {
                RectangleF oldRect;
                if (Page == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = Page.PageRect;
                }

                res.AddItem("L", CloneUtility.CopyArrayCoordinates(l, oldRect, page.PageRect, Page == null));
            }

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

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

            PDFDictionary measure = Dictionary["Measure"] as PDFDictionary;

            if (measure != null)
            {
                res.AddItem("Measure", Measure.Copy(measure));
            }

            LineAnnotation annot = new LineAnnotation(res, owner);

            annot.SetPage(page, true);

            return(annot);
        }
示例#6
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);
        }