예제 #1
0
        internal static void CopyTo(PDFDictionary sourceDict, PDFDictionary destinationDict)
        {
            string[] keys = { "H", "FT", "T", "TU", "TM", "Ff", "V", "DV" };
            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));
            }

            PDFDictionary mk = sourceDict["MK"] as PDFDictionary;

            if (mk != null)
            {
                destinationDict.AddItem("MK", AppearanceCharacteristics.Copy(mk));
            }
        }
예제 #2
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));
            }
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the Bytescout.PDF.InkAnnotation class.
        /// </summary>
        /// <param name="inkList">The Bytescout.PDF.InkList representing a stroked path.</param>
        public InkAnnotation(InkList inkList)
            : base(null)
        {
            if (inkList == null)
            {
                throw new ArgumentNullException();
            }

            if (inkList.Page != null)
            {
                _inkList = new InkList();
                for (int i = 0; i < inkList.Count; ++i)
                {
                    _inkList.AddArray(new PointsArray(inkList[i].ToArray()));
                }
            }
            else
            {
                _inkList = inkList;
            }
            _inkList.ChangedInkList += changedInkList;

            Dictionary.AddItem("Subtype", new PDFName("Ink"));
            Dictionary.AddItem("InkList", _inkList.Array);
            _borderStyle = new AnnotationBorderStyle();
            Dictionary.AddItem("BS", _borderStyle.GetDictionary());
            Color = new ColorRGB(0, 0, 0);
        }
예제 #4
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);
        }
예제 #5
0
        private void loadBorderStyle()
        {
            PDFDictionary bs = Dictionary["BS"] as PDFDictionary;

            if (bs != null)
            {
                _borderStyle = new AnnotationBorderStyle(bs);
            }
            else
            {
                _borderStyle = new AnnotationBorderStyle();
                Dictionary.AddItem("BS", _borderStyle.GetDictionary());
            }
        }
예제 #6
0
        private void loadBorderStyle()
        {
            PDFDictionary dict = Dictionary["BS"] as PDFDictionary;

            if (dict == null)
            {
                _borderStyle = new AnnotationBorderStyle();
                Dictionary.AddItem("BS", _borderStyle.GetDictionary());
            }
            else
            {
                _borderStyle = new AnnotationBorderStyle(dict);
            }
            _borderStyle.ChangedBorderStyle += changedBorderStyle;
        }
예제 #7
0
        private void loadBorderStyle()
        {
            PDFDictionary bs = Dictionary["BS"] as PDFDictionary;

            if (bs != null)
            {
                _borderStyle = new AnnotationBorderStyle(bs);
            }
            else
            {
                _borderStyle = new AnnotationBorderStyle();
                Dictionary.AddItem("BS", _borderStyle.GetDictionary());
            }
            _borderStyle.ChangedBorderStyle += new ChangedBorderStyleEventHandler(changedBorderStyle);
        }
예제 #8
0
        internal static void CopyTo(PDFDictionary sourceDict, PDFDictionary destinationDict)
        {
            string[] keys = { "IC", "BE", "RD" };
            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));
            }
        }
예제 #9
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);
        }
예제 #10
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);
        }