Frequently Asked Question

Annotation Properties (Windows)
Last Updated 11 months ago

You can get the annotation's author using the following method ()valid in professional and premium license:

 PDFAnnot.PopupLabel

If you have a premium license, you can use the advanced properties to get more data about the annotation, like the creation date, modification date...etc.

To use the advanced properties, you can do something like the following, and call checkAnnotAdvancedProp:

private String[] m_types= new String[] { "null", "boolean", "int", "real", "string", "name", "array", "dictionary", "reference", "stream" };
private String get_type_name(int type)
{
    if (type >= 0 && type < m_types.Length) return m_types[type];
    else return "unknown";
}

private void checkAnnotAdvancedProp(PDFAnnot annot)
{
    if (annot == null) return;

    handleRef(annot.Advance_GetRef());
}

private void handleRef(PDFRef pdfRef)
{
     PDFObj obj = m_doc.Advance_GetObj(pdfRef);
     handleDictionary(obj);
}

private void handleDictionary(PDFObj obj)
{
     int count = obj.DictGetItemCount();
     for (int cur = 0; cur < count; cur++)
     {
         String tag = obj.DictGetItemTag(cur);
         PDFObj item = obj.DictGetItem(cur);
         int type = item.type;
         String type_name = get_type_name(type);

         Debug.WriteLine("tag:" + cur + "---" + tag + ":" + type_name + " ->");

         if (type == 1) //boolean
               Debug.WriteLine(" value = " + item.BoolVal);
         else if (type == 2) //int
               Debug.WriteLine(" value = " + item.IntVal);
         else if (type == 3) //real
               Debug.WriteLine(" value = " + item.RealVal);
         else if (type == 4) //string
               Debug.WriteLine(" value = " + item.TextStringVal);
         else if (type == 5) //name
               Debug.WriteLine(" value = " + item.NameVal);
         else if (type == 6)
         { //array
               int arraycount = item.ArrayGetItemCount();
               for (int k = 0; k < arraycount; k++)
               {
                    PDFObj array_obj = item.ArrayGetItem(k);
                    Debug.WriteLine("array item " + k + ": value = " + array_obj.RealVal);
               }
          }
          else if (type == 7) //dictionary
                handleDictionary(item);
     }
}


Loading ...