We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Reading form fields from a lifecycle document

I'm trying to read the form fields from a lifecycle document that allows me to save the form with the field information, but when I try to parse through the collection only one fieldname is returned.

Is there something special I should be doing for working with these type of pdf forms?

I thought maybe I should use pdf generator, but I didn't see any way to actually pull the names of the textfields from the document or set their values in the documentation.

Thanks

Donna

I've attached the results of what I get when I try to ouput to the fields.

Hello Donna,


Thanks for using our products.

As far as I have understood from your requirement, you need to extract the form field values and the form field names. If so is the case, please visit the following links for information on


In case I have not properly understood your requirement or you have any further query, please feel free to contact. We are really sorry for your inconvenience.

I'm trying to both read and write to the form. I'm just setting up a simple test for the document during my trial using the field collection for form. I'm using the code from this:Get Values from all the Fields of PDF Document

My test was to get the name of the field and fill in the associated formfield box with the name of the box so that I would have all my field names for the view I would build to go with it. However the collection is only returning topmostSubform(0) as the field name and it fills in ALL the form fields with the same value. I've opened up the document in Adobe and each field does have a different name. For example the first field is name, the second dob, etc.

Do I need to use Facades for this document?

Hi Donna,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, your document contains grouped fields and you need to recursively look into all the children of the group fields. Please see the following sample code which will help you get your desired result. This code recursively iterate through all the children of the group fields and list down the fields in a list.

//open document

Document pdfDocument = new Document("E:\\AP Data\\Feb2012\\output.pdf");

foreach (Field formField in pdfDocument.Form)

{

List<string> listFields = new List<string>();

getField(formField, ref listFields);

}

//method to check all the fields

public void getField(Field field,ref List<string> listFields)

{

if (field.IsGroup)

{

foreach (Field childField in field)

{

getField(childField,ref listFields);

}

}

else

{

listFields.Add(field.FullName);

}

}

Please try it and do let us know in case you need any further assistance.

Thank You & Best Regards,

That seems to have worked, now another question. When I open up the new document I receive a message that the document has changed and I need to contact the author for the original document. Is there something I need to do to avoid this error?

Thanks for your help

Donna

Hi Donna,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please share your sample code, template PDF and resultant PDF file with us. This will help us understand and figure out the issue soon.

Sorry for the inconvenience,