internal override Action Clone(IDocumentEssential owner)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("Type", new PDFName("Action"));
            dict.AddItem("S", new PDFName("ImportData"));

            PDFDictionary fs = _dictionary["F"] as PDFDictionary;

            if (fs != null)
            {
                dict.AddItem("F", fs);
            }

            ImportDataAction action = new ImportDataAction(dict, owner);

            IPDFObject next = _dictionary["Next"];

            if (next != null)
            {
                for (int i = 0; i < Next.Count; ++i)
                {
                    action.Next.Add(Next[i]);
                }
            }

            return(action);
        }
Example #2
0
        //TODO : IT

        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                PointF[] points = Vertices.ToArray();
                ApplyOwner(owner);
                SetPage(page, true);

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

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);
            PolygonPolylineAnnotation.CopyTo(Dictionary, res, Page, page);

            PolylineAnnotation annot = new PolylineAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
        internal override Action Clone(IDocumentEssential owner)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("Type", new PDFName("Action"));
            dict.AddItem("S", new PDFName("JavaScript"));

            IPDFObject js = _dictionary["JS"];

            if (js != null)
            {
                dict.AddItem("JS", js.Clone());
            }

            JavaScriptAction action = new JavaScriptAction(dict, owner);

            IPDFObject next = _dictionary["Next"];

            if (next != null)
            {
                for (int i = 0; i < Next.Count; ++i)
                {
                    action.Next.Add(Next[i]);
                }
            }

            return(action);
        }
        internal override Action Clone(IDocumentEssential owner)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("Type", new PDFName("Action"));
            dict.AddItem("S", new PDFName("SetOCGState"));

            string[] keys = { "State", "PreserveRB" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = _dictionary[keys[i]];
                if (obj != null)
                {
                    dict.AddItem(keys[i], obj.Clone());
                }
            }

            SetOptionalContentGroupsStateAction action = new SetOptionalContentGroupsStateAction(dict, owner);

            IPDFObject next = _dictionary["Next"];

            if (next != null)
            {
                for (int i = 0; i < Next.Count; ++i)
                {
                    action.Next.Add(Next[i]);
                }
            }

            return(action);
        }
Example #5
0
        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);

            IPDFObject name = Dictionary["Name"];

            if (name != null)
            {
                res.AddItem("Name", name.Clone());
            }

            IPDFObject fs = Dictionary["FS"];

            if (fs != null)
            {
                res.AddItem("FS", fs.Clone());
            }

            FileAttachmentAnnotation annot = new FileAttachmentAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
        internal override Action Clone(IDocumentEssential owner)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("Type", new PDFName("Action"));
            dict.AddItem("S", new PDFName("Trans"));

            PDFDictionary trans = _dictionary["Trans"] as PDFDictionary;

            if (trans != null)
            {
                dict.AddItem("Trans", TransitionBase.Copy(trans));
            }

            TransitionAction action = new TransitionAction(dict, owner);

            IPDFObject next = _dictionary["Next"];

            if (next != null)
            {
                for (int i = 0; i < Next.Count; ++i)
                {
                    action.Next.Add(Next[i]);
                }
            }

            return(action);
        }
Example #7
0
        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);

            IPDFObject name = Dictionary["Name"];

            if (name != null)
            {
                res.AddItem("Name", name.Clone());
            }

            IPDFObject sound = Dictionary["Sound"];

            if (sound != null)
            {
                res.AddItem("Sound", sound);
            }

            SoundAnnotation annot = new SoundAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #8
0
        internal override Action Clone(IDocumentEssential owner)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("Type", new PDFName("Action"));
            dict.AddItem("S", new PDFName("ResetForm"));

            string[] keys = { "Flags", "Fields" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = _dictionary[keys[i]];
                if (obj != null)
                {
                    dict.AddItem(keys[i], obj.Clone());
                }
            }

            ResetFormAction action = new ResetFormAction(dict, owner);

            IPDFObject next = _dictionary["Next"];

            if (next != null)
            {
                for (int i = 0; i < Next.Count; ++i)
                {
                    action.Next.Add(Next[i]);
                }
            }

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

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            Field.CopyTo(Dictionary, res);

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

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

            annot._fontColor             = _fontColor;
            annot._font                  = _font;
            annot._font.ChangedFontSize += annot.changedFontSize;

            Field.SetActions(this, annot);

            return(annot);
        }
Example #10
0
 internal AnnotationCollections(PDFArray arr, IDocumentEssential owner, Page page)
 {
     _array = arr;
     _owner = owner;
     _page  = page;
     parseAnnotations();
 }
Example #11
0
        internal Page(PDFDictionary dict, IDocumentEssential owner)
        {
            _dictionary = dict;
            _owner      = owner;

            Watermarks = new WatermarkCollection();
        }
Example #12
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);

                float l = Left;
                float t = Top;
                float w = Width;
                float h = Height;
                float a = RotationAngle;

                Rectangle        = null;
                Rectangle.Left   = l;
                Rectangle.Top    = t;
                Rectangle.Width  = w;
                Rectangle.Height = h;
                Rectangle.Angle  = a;

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);
            TextMarkupAnnotation.CopyTo(Dictionary, res, Page, page);

            UnderlineAnnotation annot = new UnderlineAnnotation(res, owner);

            annot.SetPage(page, true);
            return(annot);
        }
Example #13
0
        private void parsePage(PDFArray arr, IDocumentEssential owner)
        {
            IPDFObject page = arr[0];

            if (page == null)
            {
                return;
            }
            if (page is PDFNumber)
            {
                _page = owner.GetPage((int)(page as PDFNumber).GetValue());
            }
            else if (page is PDFDictionary)
            {
                _page = owner.GetPage(page as PDFDictionary);
            }
            else
            {
                _page = null;
            }

            arr.RemoveItem(0);
            if (_page != null)
            {
                arr.Insert(0, _page.GetDictionary());
            }
            else
            {
                arr.Insert(0, new PDFNull());
            }
        }
Example #14
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 threeDD = Dictionary["3DD"];

            if (threeDD != null)
            {
                res.AddItem("3DD", ThreeDData.Copy(threeDD));
            }

            string[] keys = { "3DV", "3DA", "3DI", "3DB" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            ThreeDAnnotation annot = new ThreeDAnnotation(res, owner);

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

            return(annot);
        }
Example #15
0
        internal Destination(IPDFObject dest, IDocumentEssential owner)
        {
            PDFString s = dest as PDFString;

            if (s != null)
            {
                dest = owner.GetDestinationFromNames(s.GetValue());
                if (dest == null)
                {
                    dest = new PDFArray();
                }
            }

            PDFArray array = dest as PDFArray;

            if (array != null)
            {
                parsePage(array, owner);
                parseZoomMode(array);
                parseProperties(array, owner);
            }
            else
            {
                dest = new PDFArray();
            }

            _array = dest as PDFArray;
        }
Example #16
0
 internal Outline(PDFDictionary dict, IDocumentEssential owner)
 {
     _owner      = owner;
     _dictionary = dict;
     loadDestination();
     loadAction();
 }
Example #17
0
        internal RadioButton(PDFDictionary dict, IDocumentEssential owner)
            : base(dict, owner)
        {
            PDFDictionary ap = dict["AP"] as PDFDictionary;

            if (ap != null)
            {
                PDFDictionary n = ap["N"] as PDFDictionary;
                if (n != null)
                {
                    string[] keys = n.GetKeys();
                    if (keys.Length == 0)
                    {
                        _exportValue = "value1";
                    }
                    else if (keys.Length == 1)
                    {
                        _exportValue = keys[0];
                    }
                    else
                    {
                        _exportValue = keys[0] == "Off" ? keys[1] : keys[0];
                    }
                }
                else
                {
                    _exportValue = "value1";
                }
            }
            else
            {
                _exportValue = "value1";
            }
        }
Example #18
0
        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 = { "RD", "Sy" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            CaretAnnotation annot = new CaretAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #19
0
 internal Annotation(IDocumentEssential owner)
 {
     _dictionary = new PDFDictionary();
     _dictionary.AddItem("Type", new PDFName("Annot"));
     Print = true;
     Owner = owner;
 }
Example #20
0
        internal override Action Clone(IDocumentEssential owner)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("Type", new PDFName("Action"));
            dict.AddItem("S", new PDFName("Hide"));

            IPDFObject t = _dictionary["T"];

            if (t != null)
            {
                dict.AddItem("T", t.Clone());
            }

            HideAction action = new HideAction(dict, owner);

            action.Hide = Hide;

            IPDFObject next = _dictionary["Next"];

            if (next != null)
            {
                for (int i = 0; i < Next.Count; ++i)
                {
                    action.Next.Add(Next[i]);
                }
            }

            return(action);
        }
Example #21
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);
        }
Example #22
0
 internal PageCollection(IDocumentEssential owner)
 {
     _dictionary = new PDFDictionary();
     _dictionary.AddItem("Type", new PDFName("Pages"));
     _dictionary.AddItem("Count", new PDFNumber(0));
     _dictionary.AddItem("Kids", new PDFArray());
     _owner = owner;
 }
Example #23
0
 internal EditBox(PDFDictionary dict, IDocumentEssential owner, bool parseFont)
     : base(dict, owner)
 {
     if (parseFont)
     {
         parseFontAndColor();
     }
 }
 internal override void ApplyOwner(IDocumentEssential owner)
 {
     base.ApplyOwner(owner);
     if (_fields != null)
     {
         _fields.Owner = owner;
     }
 }
Example #25
0
 internal FreeTextAnnotation(PDFDictionary dict, IDocumentEssential owner, bool parseFont)
     : base(dict, owner)
 {
     if (parseFont)
     {
         parseFontAndColor();
     }
 }
Example #26
0
 internal override void ApplyOwner(IDocumentEssential owner)
 {
     Owner = owner;
     if (_action != null)
     {
         _action.ApplyOwner(owner);
     }
 }
Example #27
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);
        }
Example #28
0
 internal PushButton(PDFDictionary dict, IDocumentEssential owner, bool createFont)
     : base(dict, owner)
 {
     if (createFont)
     {
         _font = new Font(StandardFonts.Helvetica, 12);
         _font.ChangedFontSize += changedFontSize;
         _fontColor             = new ColorRGB(0, 0, 0);
     }
 }
Example #29
0
 internal virtual void ApplyOwner(IDocumentEssential owner)
 {
     _owner = owner;
     if (GetDictionary()["Next"] != null)
     {
         ActionCollection next = Next;
         for (int i = 0; i < next.Count; ++i)
         {
             next[i].ApplyOwner(owner);
         }
     }
 }
Example #30
0
        internal AnnotationCollections Clone(IDocumentEssential owner, Page page)
        {
            AnnotationCollections annots = new AnnotationCollections(owner, _page);

            annots._page = page;

            for (int i = 0; i < _annotations.Count; ++i)
            {
                annots.Add(_annotations[i]);
            }

            return(annots);
        }