Detection of Radio Buttons failed

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v11)  /  Detection of Radio Buttons failed

DynamicPDF CoreSuite for .NET (v11) Forum

 Nov 04 2022 12:04 PM
Hello together,

I enumerate the FormFieldList of a MergeDocument, getting the fields and its properties. Basically that working fine. But there ist one exception: RadioButton

int pageNumber = pdf.Form.Fields["NameOfARadioButton"].GetOriginalPageNumber() - 1;
This returns -2 for all RadioButtons. In  relation to the dedicated page, the detection of the coordinates for sure fails.

Page page = document.Pages[pageNumber];
float xPos = pdf.Form.Fields[field.Name].GetX(page);
float yPos = pdf.Form.Fields[field.Name].GetY(page);
float width = pdf.Form.Fields[field.Name].Width;
float height = pdf.Form.Fields[field.Name].Height;

Due to the negative value in pageNumber it is not possible to get a valid coordinates for GetX() or GetY().
'Forcing' pageNumber = 0 and then calling  GetX() or GetY() for the RadionButton leads to an exception.

Can you help?

Greets Robert
 Nov 04 2022 12:50 PM
Posted by a ceTe Software moderator
Hello,

You are getting -2 as page number because it is a container element that returns -1 as the page number. Elements that are not visible on any page will return a page number of -1. The actual radio buttons are probably child fields of the container element. You will need to loop through the child fields of the respective parent (container field) to get the page number.

If you continue facing an issue, then please send the following information to support@dynamicpdf.com so we can look into it further.

1. Source PDF using which you are seeing this behavior.
2. Code sample which uses static data to recreate the behavior.
3. Exact version and build number of DynamicPDF Core Suite DLL file used in your application. You can find this information by right clicking on the DLL file>>Properties>>Details tab>>Product version. Take a screenshot of the Details tab and send it over to us.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 8:24 PM.