Frequently Asked Question

Annotation Properties
Last Updated a year ago

You can get the annotation's author using the following method:

/**
 * get annotation's popup text, mostly it means the author.
 * if this annotation is popup annotation, it get parent annotation's label.
 * this method require professional or premium license.
 * @return text string or null if failed.
 */

final public String GetPopupLabel() {}

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:

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


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

   handleRef(annot.Advance_GetRef());
}

private void handleRef(Ref ref) {
   if(ref != null) {
      Obj obj = m_doc.Advance_GetObj(ref);
      handleDictionary(obj);
   }
}

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

      Log.i("--ADV--","tag:" + cur + "---" + tag + ":" + type_name + " ->");

      if(type == 1) //boolean
         Log.i("--ADV--"," value = " + item.GetBoolean());
      else if(type == 2) //int
         Log.i("--ADV--"," value = " + item.GetInt());
      else if(type == 3) //real
         Log.i("--ADV--"," value = " + item.GetReal());
      else if(type == 4) //string
         Log.i("--ADV--"," value = " + item.GetTextString());
      else if(type == 5) //name
         Log.i("--ADV--"," value = " + item.GetName());
      else if(type == 6) { //array
         int arraycount = item.ArrayGetItemCount();
         for(int k = 0; k < arraycount; k++) {
            Obj array_obj = item.ArrayGetItem(k);
            Log.i("--ADV--","array item " + k + ": value = " + array_obj.GetReal());
         }
      }
      else if (type == 7) //dictionary
         handleDictionary(item);
   }
}


Loading ...