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

Free Support Forum - aspose.com

Export values not updateing in drop down list

Hi,

I'm trying to update export values in a PDF form drop down list with the AddListItem() method of the FormEditor class.

When I populate text only it works fine, but when I try to update text+export values, the list is not updated and no exception is thrown.

A test script and PDF documents are attached. In the PDF document, the field that works correctly is captioned "Consumer Unit Material Type", the one that doesn't is "Consumer Unit Package Type". Both are on page two of the form.

I am using version 3.1.0.0 of Aspose.Pdf.Kit for .Net 2.0.

Please let me know how to proceed.

Thanks

Bill Blinco

Hello Bill,

I have tested the issue with following code snippet, and the data is being populated correctly in both the dropdowns. Please take a review.

FormEditor pdfe = new FormEditor(@"C:\Temp\2k3\test\test\testin.pdf", @"C:\Temp\2k3\test\test\testout_2.pdf");
String[] strItem ={ "test", "test2" };

pdfe.AddListItem(@"form1[0].#subform[1].UT_855_Unit_Material[0]", strItem[1]);

pdfe.AddListItem(@"form1[0].#subform[1].UT_855_Unit_PackageType[0]", strItem[0]);
pdfe.Save();

Hi,

It appears you have changed the second AddListItem() method call to pass only one element of the string array strItem(). I intend for the second call to pass BOTH elements of the array so that the second element ("test2") becomes the export value for the drop down list.

The first method call is just to illustrate that it does work for the non export value overload.

Try this code snippet:

FormEditor pdfe = new FormEditor(@"C:\Temp\2k3\test\test\testin.pdf", @"C:\Temp\2k3\test\test\testout_2.pdf");
String[] strItem ={ "test", "test2" };

pdfe.AddListItem(@"form1[0].#subform[1].UT_855_Unit_Material[0]", strItem[1]);

pdfe.AddListItem(@"form1[0].#subform[1].UT_855_Unit_PackageType[0]", strItem);
pdfe.Save();

Thanks

Bill

Dear Bill,

Thanks for considering Aspose.Pdf.Kit.

Adding a new item with Export value to existing list box field only supported AcroForm combo box field. Please refer to the API. We are working to improve this feature, but cannot give a clear ETA. We will inform you immediately in this thread when it finished.

Sorry for the inconvenience & Best regards.

Hi Luke,

As far as I can tell it IS a combo box field we're trying to populate. Am I missing something?

Bill

Dear Bill,

I am sorry to maze you so much. In fact there are two families of fields: AcroForm fields and XfaForm fields. The former is defined in old PDF specification before Adobe 6.0v, while the other came out with Adobe 7.0 and above.

With Kit, you can add items without exporting value to combo box either in AcroForm or in XfaForm, but you can only add items with exporting value in AcroForm, excluding XfaForm. Unfortunately, your PDF template belongs to XfaForm.

Am I clear? Please feel free if you still have any question.

Best regards.

Hi Luke,

Thanks for that. I understand now.