public override void AfterClone( Cloner cloner, PdfObject clone, PdfObject source ) { /* * NOTE: Inheritable attributes have to be consolidated into the cloned page dictionary in * order to ensure its consistency. */ PdfDictionary cloneDictionary = (PdfDictionary)clone; PdfDictionary sourceDictionary = (PdfDictionary)source; foreach (PdfName key in Page.InheritableAttributeKeys) { if (!sourceDictionary.ContainsKey(key)) { PdfDirectObject sourceValue = Page.GetInheritableAttribute(sourceDictionary, key); if (sourceValue != null) { cloneDictionary[key] = (PdfDirectObject)sourceValue.Accept(cloner, null); } } } }
public override bool Matches( Cloner cloner, PdfObject source ) { if (source is PdfArray) { PdfArray array = (PdfArray)source; if (array.Count > 0) { PdfDataObject arrayItem = array.Resolve(0); if (arrayItem is PdfDictionary) { PdfDictionary arrayItemDictionary = (PdfDictionary)arrayItem; return(arrayItemDictionary.ContainsKey(PdfName.Subtype) && arrayItemDictionary.ContainsKey(PdfName.Rect)); } } } return(false); }
/** * <summary>Gets the given node's children.</summary> * <param name="node">Parent node.</param> * <param name="pairs">Pairs key.</param> */ public static Children Get( PdfDictionary node, PdfName pairsKey ) { PdfName childrenTypeName; if (node.ContainsKey(PdfName.Kids)) { childrenTypeName = PdfName.Kids; } else if (node.ContainsKey(pairsKey)) { childrenTypeName = pairsKey; } else { throw new Exception("Malformed tree node."); } return(new Children(node, childrenTypeName)); }
public override void AfterClone( Cloner cloner, PdfArray source, PdfArray clone, int index, PdfDirectObject item ) { PdfDictionary annotation = (PdfDictionary)item.Resolve(); if (annotation.ContainsKey(PdfName.FT)) { cloner.context.Document.Form.Fields.Add(Field.Wrap(annotation.Reference)); } else if (annotation.ContainsKey(PdfName.Dest)) { PdfDirectObject destObject = annotation[PdfName.Dest]; if (destObject is PdfString) // Named destination. { CloneNamedObject <Destination>(cloner, source, (PdfString)destObject); } } }
public override void AfterClone( Cloner cloner, PdfArray parent, int index, PdfDirectObject item ) { PdfDictionary annotation = (PdfDictionary)item.Resolve(); if (annotation.ContainsKey(PdfName.FT)) { cloner.context.Document.Form.Fields.Add(Field.Wrap(annotation.Reference)); } }