internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary newDict = new PDFDictionary(); PDFBoolean k = dict["K"] as PDFBoolean; if (k != null) { newDict.AddItem("K", k.Clone()); } PDFBoolean i = dict["I"] as PDFBoolean; if (i != null) { newDict.AddItem("I", i.Clone()); } PDFName s = dict["S"] as PDFName; if (s != null) { newDict.AddItem("S", s.Clone()); } IPDFObject cs = dict["CS"]; if (cs != null) { newDict.AddItem("CS", cs.Clone()); } return(newDict); }
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); }
//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)); } }
internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary result = new PDFDictionary(); string[] keys = { "Type", "Subtype", "R", "CYX", "O" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = dict[keys[i]]; if (obj != null) { result.AddItem(keys[i], obj.Clone()); } } string[] numberFormat = { "X", "Y", "D", "A", "T", "S" }; for (int i = 0; i < numberFormat.Length; ++i) { PDFArray arr = dict[numberFormat[i]] as PDFArray; if (arr != null) { PDFArray newArr = new PDFArray(); for (int j = 0; j < arr.Count; ++i) { PDFDictionary d = arr[i] as PDFDictionary; if (d != null) { newArr.AddItem(NumberFormat.Copy(d)); } } result.AddItem(numberFormat[i], newArr); } } return(result); }
internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary result = new PDFDictionary(); string[] keys = { "Type", "W", "S" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = dict[keys[i]]; if (obj != null) { result.AddItem(keys[i], obj.Clone()); } } PDFArray dash = dict["D"] as PDFArray; if (dash != null) { PDFArray arr = new PDFArray(); for (int i = 0; i < dash.Count; ++i) { arr.AddItem(dash[i].Clone()); } result.AddItem("D", arr); } return(result); }
internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary result = new PDFDictionary(); string[] keys = { "R", "BC", "BG", "CA", "RC", "AC", "TP", "IF" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = dict[keys[i]]; if (obj != null) { result.AddItem(keys[i], obj.Clone()); } } string[] xObjects = { "I", "RI", "IX" }; for (int i = 0; i < xObjects.Length; ++i) { PDFDictionaryStream stream = dict[xObjects[i]] as PDFDictionaryStream; if (stream != null) { result.AddItem(xObjects[i], GraphicsTemplate.Copy(stream)); } } return(result); }
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); }
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); }
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); }
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 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); }
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); }
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)); } }
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); }
internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary newDict = new PDFDictionary(); string[] keys = { "Type", "Subtype", "Rect", "Contents", "NM", "M", "F", "Border", "C", "AS" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = dict[keys[i]]; if (obj != null) { newDict.AddItem(keys[i], obj.Clone()); } } PDFDictionary ap = dict["AP"] as PDFDictionary; if (ap != null) { newDict.AddItem("AP", copyAppearance(ap)); } // P, StructParent - do not // OS - still unknown return(newDict); }
// 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); }
internal static PDFDictionaryStream Copy(PDFDictionaryStream dictStream) { Stream stream = dictStream.GetStream(); byte[] buf = new byte[stream.Length]; stream.Position = 0; stream.Read(buf, 0, buf.Length); MemoryStream newStream = new MemoryStream(); newStream.Write(buf, 0, buf.Length); PDFDictionary dict = dictStream.Dictionary; PDFDictionary newDict = new PDFDictionary(); string[] keys = { "Type", "Subtype", "FormType", "BBox", "Matrix", "Ref", "Metadata", "LastModified", "Name" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = dict[keys[i]]; if (obj != null) { newDict.AddItem(keys[i], obj.Clone()); } } PDFDictionary resources = dict["Resources"] as PDFDictionary; if (resources != null) { newDict.AddItem("Resources", ResourcesBase.Copy(resources)); } PDFDictionary group = dict["Group"] as PDFDictionary; if (group != null) { newDict.AddItem("Group", GroupBase.Copy(group)); } // PieceInfo, OPI, OC - still unknown // StructParent, StructParents - do not IPDFObject filter = dict["Filter"]; if (filter != null) { newDict.AddItem("Filter", filter.Clone()); } IPDFObject decodeParms = dict["DecodeParms"]; if (decodeParms != null) { newDict.AddItem("DecodeParms", decodeParms.Clone()); } return(new PDFDictionaryStream(newDict, newStream)); }
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); }
internal static void Copy(PDFDictionary sourceDict, PDFDictionary destinationDict) { string[] keys = { "Opt", "TI", "I", "Q", "RV" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = sourceDict[keys[i]]; if (obj != null) { destinationDict.AddItem(keys[i], obj.Clone()); } } }
internal static void CopyTo(PDFDictionary sourceDict, PDFDictionary destinationDict) { string[] keys = { "Open", "T", "CA", "CreationDate", "Subj", "RT", "RC" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = sourceDict[keys[i]]; if (obj != null) { destinationDict.AddItem(keys[i], obj.Clone()); } } //Popup - need set after adding //IRT, ExData - TODO }
internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary newDict = new PDFDictionary(); string[] keys = { "Type", "S", "D", "Dm", "M", "Di", "SS", "B" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject val = dict[keys[i]]; if (val != null) { newDict.AddItem(keys[i], val.Clone()); } } return(newDict); }
internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary result = new PDFDictionary(); string[] keys = { "Type", "U", "C", "F", "D", "FD", "RT", "RD", "PS", "SS", "O" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = dict[keys[i]]; if (obj != null) { result.AddItem(keys[i], obj.Clone()); } } return(result); }
internal static PDFDictionary Copy(PDFDictionary dict) { PDFDictionary result = new PDFDictionary(); string[] keys = { "Start", "Duration", "Rate", "Volume", "ShowControls", "Mode", "Synchronous", "FWScale", "FWPosition" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = dict[keys[i]]; if (obj != null) { result.AddItem(keys[i], obj.Clone()); } } return(result); }
internal override Annotation Clone(IDocumentEssential owner, Page page) { PDFDictionary res = AnnotationBase.Copy(Dictionary); IPDFObject open = Dictionary["Open"]; if (open != null) { res.AddItem("Open", open.Clone()); } PopupAnnotation annot = new PopupAnnotation(res, owner); annot.SetPage(Page, false); annot.SetPage(page, true); return(annot); }
internal override Annotation Clone(IDocumentEssential owner, Page page) { if (Page == null) { ApplyOwner(owner); SetPage(page, true); return(this); } PDFDictionary res = AnnotationBase.Copy(Dictionary); IPDFObject t = Dictionary["T"]; if (t != null) { res.AddItem("T", t.Clone()); } PDFDictionary movie = Dictionary["Movie"] as PDFDictionary; if (movie != null) { res.AddItem("Movie", MovieBase.Copy(movie)); } IPDFObject a = Dictionary["A"]; if (a != null) { if (a is PDFBoolean) { res.AddItem("A", a.Clone()); } else if (a is PDFDictionary) { res.AddItem("A", MovieActivationBase.Copy(a as PDFDictionary)); } } MovieAnnotation annot = new MovieAnnotation(res, owner); annot.SetPage(Page, false); annot.SetPage(page, true); return(annot); }
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)); } }
internal override Annotation Clone(IDocumentEssential owner, Page page) { if (Page == null) { ApplyOwner(owner); SetPage(page, true); return(this); } PDFDictionary res = AnnotationBase.Copy(Dictionary); IPDFObject t = Dictionary["T"]; if (t != null) { res.AddItem("T", t.Clone()); } PDFDictionary mk = Dictionary["MK"] as PDFDictionary; if (mk != null) { res.AddItem("MK", AppearanceCharacteristics.Copy(mk)); } ScreenAnnotation annot = new ScreenAnnotation(res, owner); annot.SetPage(Page, false); annot.SetPage(page, true); annot.OnActivated = OnActivated; annot.OnMouseDown = OnMouseDown; annot.OnMouseEnter = OnMouseEnter; annot.OnMouseExit = OnMouseExit; annot.OnMouseUp = OnMouseUp; annot.OnPageClose = OnPageClose; annot.OnPageInvisible = OnPageInvisible; annot.OnPageOpen = OnPageOpen; annot.OnPageVisible = OnPageVisible; return(annot); }
internal override Action Clone(IDocumentEssential owner) { PDFDictionary dict = new PDFDictionary(); dict.AddItem("Type", new PDFName("Action")); dict.AddItem("S", new PDFName("Launch")); PDFDictionary fs = _dictionary["F"] as PDFDictionary; if (fs != null) { dict.AddItem("F", fs); } string[] keys = { "Win", "Mac", "Unix", "NewWindow" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = _dictionary[keys[i]]; if (obj != null) { dict.AddItem(keys[i], obj.Clone()); } } LaunchAction action = new LaunchAction(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("Thread")); IPDFObject fs = m_dictionary["F"]; if (fs != null) { dict.AddItem("F", fs); } string[] keys = { "D", "B" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = m_dictionary[keys[i]]; if (obj != null) { dict.AddItem(keys[i], obj.Clone()); } } ThreadAction action = new ThreadAction(dict, owner); IPDFObject next = m_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("Sound")); IPDFObject sound = _dictionary["Sound"]; if (sound != null) { dict.AddItem("Sound", sound); } string[] keys = { "Volume", "Synchronous", "Repeat", "Mix" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = _dictionary[keys[i]]; if (obj != null) { dict.AddItem(keys[i], obj.Clone()); } } SoundAction action = new SoundAction(dict, owner); IPDFObject next = _dictionary["Next"]; if (next != null) { for (int i = 0; i < Next.Count; ++i) { action.Next.Add(Next[i]); } } return(action); }