Ejemplo n.º 1
0
            internal void GetDescendantNames(ref List <string> names, string partialName)
            {
                int count = Elements.Count;

                for (int idx = 0; idx < count; idx++)
                {
                    PdfAcroField field = this[idx];
                    if (field != null)
                    {
                        field.GetDescendantNames(ref names, partialName);
                    }
                }
            }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets a field from the collection. For your convenience an instance of a derived class like
 /// PdfTextField or PdfCheckBox is returned if PDFsharp can guess the actual type of the dictionary.
 /// If the actual type cannot be guessed by PDFsharp the function returns an instance
 /// of PdfGenericField.
 /// </summary>
 public PdfAcroField this[int index]
 {
     get
     {
         PdfItem item = Elements[index];
         Debug.Assert(item is PdfReference);
         PdfDictionary dict = ((PdfReference)item).Value as PdfDictionary;
         Debug.Assert(dict != null);
         PdfAcroField field = dict as PdfAcroField;
         if (field == null && dict != null)
         {
             // Do type transformation
             field = CreateAcroField(dict);
             //Elements[index] = field.XRef;
         }
         return(field);
     }
 }
Ejemplo n.º 3
0
            internal PdfAcroField GetValue(string name)
            {
                if (String.IsNullOrEmpty(name))
                {
                    return(null);
                }

                int    dot    = name.IndexOf('.');
                string prefix = dot == -1 ? name : name.Substring(0, dot);
                string suffix = dot == -1 ? "" : name.Substring(dot + 1);

                int count = Elements.Count;

                for (int idx = 0; idx < count; idx++)
                {
                    PdfAcroField field = this[idx];
                    if (field.Name == prefix)
                    {
                        return(field.GetValue(suffix));
                    }
                }
                return(null);
            }