示例#1
0
        /** Sets all the fields from this <CODE>FdfReader</CODE>
         * @param fdf the <CODE>FdfReader</CODE>
         */
        public void SetFields(FdfReader fdf)
        {
            Hashtable map = fdf.Fields;

            foreach (DictionaryEntry entry in map)
            {
                String        key = (String)entry.Key;
                PdfDictionary dic = (PdfDictionary)entry.Value;
                PdfObject     v   = dic.Get(PdfName.V);
                if (v != null)
                {
                    SetField(key, v);
                }
                v = dic.Get(PdfName.A); // (plaflamme)
                if (v != null)
                {
                    SetField(key, v);
                }
            }
        }
示例#2
0
 /**
  * Adds the comments present in an FDF file.
  * @param fdf the FDF file
  * @throws IOException on error
  */
 public void AddComments(FdfReader fdf)
 {
     stamper.AddComments(fdf);
 }
示例#3
0
 /** Sets the fields by FDF merging.
 * @param fdf the FDF form
 * @throws IOException on error
 * @throws DocumentException on error
 */
 public void SetFields(FdfReader fdf)
 {
     Hashtable fd = fdf.Fields;
     foreach (string f in fd.Keys) {
         String v = fdf.GetFieldValue(f);
         if (v != null)
             SetField(f, v);
     }
 }
示例#4
0
 /**
 * @param fdf
 * @throws IOException
 */
 public void AddComments(FdfReader fdf)
 {
     if (readers2intrefs.ContainsKey(fdf))
         return;
     PdfDictionary catalog = fdf.Catalog;
     catalog = catalog.GetAsDict(PdfName.FDF);
     if (catalog == null)
         return;
     PdfArray annots = catalog.GetAsArray(PdfName.ANNOTS);
     if (annots == null || annots.Size == 0)
         return;
     RegisterReader(fdf, false);
     IntHashtable hits = new IntHashtable();
     Hashtable irt = new Hashtable();
     ArrayList an = new ArrayList();
     for (int k = 0; k < annots.Size; ++k) {
         PdfObject obj = annots[k];
         PdfDictionary annot = (PdfDictionary)PdfReader.GetPdfObject(obj);
         PdfNumber page = annot.GetAsNumber(PdfName.PAGE);
         if (page == null || page.IntValue >= reader.NumberOfPages)
             continue;
         FindAllObjects(fdf, obj, hits);
         an.Add(obj);
         if (obj.Type == PdfObject.INDIRECT) {
             PdfObject nm = PdfReader.GetPdfObject(annot.Get(PdfName.NM));
             if (nm != null && nm.Type == PdfObject.STRING)
                 irt[nm.ToString()] = obj;
         }
     }
     int[] arhits = hits.GetKeys();
     for (int k = 0; k < arhits.Length; ++k) {
         int n = arhits[k];
         PdfObject obj = fdf.GetPdfObject(n);
         if (obj.Type == PdfObject.DICTIONARY) {
             PdfObject str = PdfReader.GetPdfObject(((PdfDictionary)obj).Get(PdfName.IRT));
             if (str != null && str.Type == PdfObject.STRING) {
                 PdfObject i = (PdfObject)irt[str.ToString()];
                 if (i != null) {
                     PdfDictionary dic2 = new PdfDictionary();
                     dic2.Merge((PdfDictionary)obj);
                     dic2.Put(PdfName.IRT, i);
                     obj = dic2;
                 }
             }
         }
         AddToBody(obj, GetNewObjectNumber(fdf, n, 0));
     }
     for (int k = 0; k < an.Count; ++k) {
         PdfObject obj = (PdfObject)an[k];
         PdfDictionary annot = (PdfDictionary)PdfReader.GetPdfObject(obj);
         PdfNumber page = annot.GetAsNumber(PdfName.PAGE);
         PdfDictionary dic = reader.GetPageN(page.IntValue + 1);
         PdfArray annotsp = (PdfArray)PdfReader.GetPdfObject(dic.Get(PdfName.ANNOTS), dic);
         if (annotsp == null) {
             annotsp = new PdfArray();
             dic.Put(PdfName.ANNOTS, annotsp);
             MarkUsed(dic);
         }
         MarkUsed(annotsp);
         annotsp.Add(obj);
     }
 }
示例#5
0
 /** Sets all the fields from this <CODE>FdfReader</CODE>
 * @param fdf the <CODE>FdfReader</CODE>
 */
 public void SetFields(FdfReader fdf)
 {
     Hashtable map = fdf.Fields;
     foreach (DictionaryEntry entry in map) {
         String key = (String)entry.Key;
         PdfDictionary dic = (PdfDictionary)entry.Value;
         PdfObject v = dic.Get(PdfName.V);
         if (v != null) {
             SetField(key, v);
         }
         v = dic.Get(PdfName.A); // (plaflamme)
         if (v != null) {
             SetField(key, v);
         }
     }
 }
示例#6
0
 /**
 * Adds the comments present in an FDF file.
 * @param fdf the FDF file
 * @throws IOException on error
 */
 public void AddComments(FdfReader fdf)
 {
     stamper.AddComments(fdf);
 }