There are indeed 3 checkboxes in one group and 3 radio buttons in another group. Either podofopdfinfo info is wrongly reading acroforms or bug is in podofo depending on point of view (I have feeling that code for acroforms was written 10 years ago and no change was made since then). Acroform fields are not always also annotations as single object. Podofo is correctly looking at FT key of Parent of annotation when it has no FT key but then it is not doing so for other acroform field keys like Ff which determines whether it is checkbox, radio button or push button (for FT Btn). To read acroforms correctly using current podofo you need to check whether has annotation Parent key and if yes then create PdfField instance from it instead of from annotation itself. As also states pdf reference Ff key is inheritable like FT and some other keys.
These are checkboxes (checkboxes in one group can behave similarly to radio buttons if they have different AP->N "on" keys in annotation): Actual acroform field resp. as states pdf reference nonterminal field, container for inheritable attributes like FT, Ff (missing Ff means 0 which means checkbox): 72 0 obj <</T(RadioCheck)/DA(/ZaDb 0 Tf 0 0 0.5 rg)/FT/Btn/Kids[63 0 R 70 0 R 79 0 R]>> endobj Annotations (define visuals of 3 checkboxes which are in group because they have same Parent object 72), these are actual 3 checkboxes and inherits some keys from object 72 like FT and Ff: 63 0 obj <</Rect[85.8274 498.234 107.887 518.403]/Subtype/Widget/Parent 72 0 R/F 4/P 44 0 R/Type/Annot/MK<</BG[1.0]/CA(l)/BC[0.0]>>/AP<</D<</Opt1 65 0 R/Off 66 0 R>>/N<</Opt1 67 0 R/Off 68 0 R>>>>/AS/Off>> endobj 70 0 obj <</Rect[179.327 498.234 201.387 518.403]/Subtype/Widget/Parent 72 0 R/F 4/P 44 0 R/Type/Annot/MK<</BG[1.0]/CA(l)/BC[0.0]>>/AP<</D<</Opt2 74 0 R/Off 75 0 R>>/N<</Opt2 76 0 R/Off 77 0 R>>>>/AS/Off>> endobj 79 0 obj <</Rect[278.281 498.234 300.341 518.403]/Subtype/Widget/Parent 72 0 R/F 4/P 44 0 R/Type/Annot/MK<</BG[1.0]/CA(l)/BC[0.0]>>/AP<</D<</Opt3 82 0 R/Off 83 0 R>>/N<</Opt3 84 0 R/Off 85 0 R>>>>/AS/Off>> endobj Here are normal radio buttons (Ff 49152): 142 0 obj <</T(OrdinaryRadio)/FT/Btn/Ff 49152/Kids[125 0 R 140 0 R 143 0 R]>> endobj 125 0 obj <</Rect[85.8274 409.789 107.887 429.958]/Subtype/Widget/BS<</S/I/W 1>>/Parent 142 0 R/F 4/P 44 0 R/Type/Annot/MK<</BG[1.0]/BC[0.0]>>/AP<</D<</Opt1 195 0 R/Off 196 0 R>>/N<</Opt1 193 0 R/Off 194 0 R>>>>/AS/Off>> endobj 140 0 obj <</Rect[179.327 409.789 201.387 429.958]/Subtype/Widget/BS<</S/I/W 1>>/Parent 142 0 R/F 4/P 44 0 R/Type/Annot/MK<</BG[1.0]/CA(l)/BC[0.0]>>/AP<</D<</Opt2 199 0 R/Off 200 0 R>>/N<</Opt2 197 0 R/Off 198 0 R>>>>/AS/Off>> endobj 143 0 obj <</Rect[278.281 409.789 300.341 429.958]/Subtype/Widget/BS<</S/I/W 1>>/Parent 142 0 R/F 4/P 44 0 R/Type/Annot/MK<</BG[1.0]/CA(l)/BC[0.0]>>/AP<</D<</Opt3 203 0 R/Off 204 0 R>>/N<</Opt3 201 0 R/Off 202 0 R>>>>/AS/Off>> endobj On Wed, Mar 20, 2019 at 4:06 AM stefa...@t-online.de <stefa...@t-online.de> wrote: > Currently I'm working on parsing existing PDF files, not generating new > PDF documents. > > > > > If you are sure that you have some radio buttons then check what is > returning curField.GetType(). > > > I am sure that GetType() will return correctly ePdfField_RadioButton for > radio buttons as I am > > > using it but I never tried IsRadioButton() function. > > > > The result using GetType() is the same. To test again I used this PDF file > that containts three checkboxes and three radio buttons: > > > > www.windjack.com/DownLoads/RadioCheckBox_AcroForm.pdf > <https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=50&ved=2ahUKEwikn-z4io_hAhUHzaQKHS9VAww4KBAWMAl6BAgJEAI&url=http%3A%2F%2Fwww.windjack.com%2FDownLoads%2FRadioCheckBox_AcroForm.pdf&usg=AOvVaw1WacoDYZUmb5HrZYNE2QcD> > > > > See my code and the resulting log output: > > > > switch (curField.GetType()) > > { > > case ePdfField_RadioButton: > > logMsg += "Type RadioButton " + > std::to_string(curField.GetType()) + "\n"; > > break; > > > > case ePdfField_CheckBox: > > logMsg += "Type CheckBox " + > std::to_string(curField.GetType()) + "\n"; > > break; > > [...] > > } > > > > PDF Version: 1.4 > Page Count: 1 > Page: 0 > Mediabox: [ 0.000000 0.000000 612.000000 792.000000 ] > Rotation: 0 > Annotations: 7 > Type CheckBox 1 > Type CheckBox 1 > Type CheckBox 1 > Type CheckBox 1 > Type CheckBox 1 > Type CheckBox 1 > > > > Also, PoDoFo's tool 'podofopdfinfo.exe' reports for all annotations in > that file the same "Type 19". Could you validate this? > > > > Thanks, > > Stefan > > > > > >
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users