Get Form Field Properties

I need an answer to a problem, I checked your documentation and I cannot find a way to get field properties we need from pdf forms. (to identify dynamic form sections programmatically)

In live cycle designer, if I open a PDF Form built with xfa form field type, I have an XML Source where I can see the element type I need: maxOccurs=”unbounded”
Aspose can detect such field properties?

Below is an extract from xml source from LiveCycle Designer in case you want to see how it looks.

<xs:element maxOccurs=“unbounded” name=“altDocc”>
xs:complexType
xs:sequence
<xs:element name=“altDoc”/>
<xs:element name=“pagAltDoc”/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs=“unbounded” name=“altDocSpec”>
xs:complexType
xs:sequence
<xs:element name=“altDocSpec”/>
<xs:element name=“pagAltDocSpec”/>
</xs:sequence>
</xs:complexType>
</xs:element>

If aspose cannot extract this information from pdf, is there another way to detect dynamic form sections?

Thank you

@CatalinBombea

Would you kindly share a sample PDF document which contains such form fields containing XML definition you shared above. We will test the scenario in our environment and address it accordingly.

Here is the file. In pages 5, 6 and 8 there are dynamic sections, with buttons to add or delete rows.
AP_1.1.pdf (2.7 MB)
Thank you

@CatalinBombea

Thank you for sharing requested data.

The PDF document contains dynamic form which can be checked with Form.Type property. Other properties exposed by XFA Class, like field names can be accessed with below code snippet.

Document document = new Document(dataDir + "AP_1.1.pdf");
var type = document.Form.Type;
Console.WriteLine("Type: " + type);
foreach (String name in document.Form.XFA.FieldNames)
{
    Console.WriteLine("Field Name: " + name);
}

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Hi @Farhan.Raza,
Thank you for you answer.
Indeed, Form.Type will return the type of the entire form, but I need to find which specific fields are dynamic, not all fields are dynamic.
foreach (String name in document.Form.XFA.FieldNames) will just list the field names, will not identify the dynamic elements tagged with maxOccurs=“unbounded”:
<xs:element **maxOccurs=“unbounded”** name=“altDocc”>
Can aspose identify the type at field level, not just at document level?
Thank you

@CatalinBombea

We are afraid type may not be determined at field level so we have logged a ticket with ID PDFNET-47077 for further investigations and resolution. We will let you know once any information will be available in this regard.

ok, thank you.

New question on this subject:
Is aspose able to expose the xml schema of the xfa form?
If I have that xml source, I can read what I need from xml schema. (the maxOccurs property is set to “unbounded” for dynamic fields).
The schema for the previously uploaded pdf looks like in the image attached. (it’s extracted using livecycle designer at this moment)
schema.jpg (83.7 KB)
Thank you
Catalin

@CatalinBombea

We are afraid this feature may not be available in the API. However, we have recorded your concerns and will let you know once any further update will be available in this regard.