Frequently Asked Question

Get OpenAction metadata using Advanced properties
最后更新 一年前

Using the Advanced properties, you can get the initial View mode (managed by Acrobat) from metadata, check the below code:

Note: a premium license is needed.

String viewMode = "Fit";
Ref ref = m_doc.Advance_GetRef();
if(ref != null) {
    Obj rootObj = m_doc.Advance_GetObj(ref);
    if(rootObj != null) {
        int count = rootObj.DictGetItemCount();
        for(int cur = 0; cur < count; cur++) {
            String tag = rootObj.DictGetItemTag(cur);
            Obj item = rootObj.DictGetItem(cur);
            if(tag.equals("OpenAction") && item.GetType() == 8) {
                rootObj = m_doc.Advance_GetObj(item.GetReference());
                if(rootObj.DictGetItemCount() > 0 && rootObj.DictGetItem(0).GetType() == 6) {
                    item = rootObj.DictGetItem(0);
                    int arrayCount = item.ArrayGetItemCount();
                    if(arrayCount > 1) {
                        viewMode = item.ArrayGetItem(1).GetName();
                        break;
                    }
                }
            }
        }
    }
}


正在加载……