> In this way can be used curField.GetType()
> or one can manually read FT, Ff and other keys
> by traversing through "Parent path" if specified key in actual node is
> missing (as pdf reference does not says that also Parent
> cannot have another Parent and so on).
 
Thank you very much Michal! That was most helpful and I found a solution.
 
Since all radio buttons in a group share the same parent, I can now also 
extract the grouping information.
For everyone facing the same problem, see code here:
 
 for (int i = 0; i < curPage->GetNumAnnots(); i++)
        {
            curAnno = curPage->GetAnnotation(i);
            mRect = curAnno->GetRect();
 
            PdfField curField = curPage->GetField(i);
 
            switch (curField.GetType())
            {
                case ePdfField_RadioButton:
                case ePdfField_CheckBox:
                {
                    PdfObject *parent = 
curField.GetFieldObject()->GetIndirectKey("Parent");
 
                    if (parent)
                    {
                    // See Standard PDF 32000-1:2018
                    // 12.7 Interactive Forms / 12.7.4 Field Types ff           
         
                        if (parent->GetDictionary().HasKey("Ff"))
                        {
                          uint32_t oid = parent->Reference().ObjectNumber();
                          log += "Type: Radiobutton.  Has Parent #" + 
std::to_string(oid) + " ";
 
                          PdfObject *key = parent->GetDictionary().GetKey("Ff");
 
                          long Ff = static_cast<long>(key->GetNumber());
 
                          if (Ff & 0x4000) // Bit 15
                              log += "[NoToogleToOff is set] ";
 
                          if (Ff & 0x8000) // Bit 16
                              log += "[Is RadioButton is set] ";
                         }
                         else
                             log += "Type: Checkbox\n";
                    }
                }; break;
[...]

_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to