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

Free Support Forum - aspose.com

Add choices to an existing dropdown list

Hi!


I’ve got a PDF document created by Adobe LiveCycle Designer ES2 that I would like to edit using Aspose.Pdf.

My goal is to create the document using Adobe LiveCycle, leave the dropdown list empty, and fill the choices using code.

I’ve tried using a FormEditor & a Facade to achieve this, but without any success so far (it doesn’t seem to find the fields although they are indeed inside the XFA of the document).

I also tried accessing the XFA as mentionned here :
https://forum.aspose.com/t/99293
But also without success.

I am using the 9.5.0.0 version, .NET framework 4.0

I have attached a very simple example of a pdf file with a dropdown I would like to edit

Could you provide me with some help ?
Thanks !

Regards

Hi there,


Thank you for your request. Our support team are looking into this request and will answer as soon as possible, please hold tight.
Thanks,

Hi Mathieu,


Sorry for the delayed response. After initial investigation we have logged your requirement as PDFNEWNET-37348 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-37348) have been fixed in Aspose.Pdf for .NET 9.7.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Mathieu,


Customer’s document contains XFA form. That’s why XML template of the document must be updated in order to add choice. Please use the following snippet:

Document doc = new
Document(“37348.pdf”);<o:p></o:p>

string[] fields = doc.Form.XFA.FieldNames;

XmlNode node = doc.Form.XFA.GetFieldTemplate(fields[0]);

XmlNode items = node.SelectSingleNode("tpl:items", doc.Form.XFA.NamespaceManager);

XmlNode item = items.OwnerDocument.CreateNode(XmlNodeType.Element, "text", items.NamespaceURI);

item.InnerText = "Choice # 4 ( New )";

items.AppendChild(item);

doc.Save("37348-out.pdf");

Please feel free to contact us for any further assistance.


Best Regards,