When I try to change a ComboBoxField value of a PDF document, the value is double encoded.
This does not occur when I try to set it to a value that is not included in the options.
Example (snippet):
Document pdf = aspose.pdf.Document("word-with-form-fields.pdf");
Form form = pdf.getForm();
TextBoxField text1 = form.get('Text1');
ComboBoxField dropdown1 = form.get('Dropdown1');
// Get the current values
string text1Value = text1.getValue();
string dropdown1Value = dropdown1.getValue();
// text1Value contains "................................"
// dropdown1Value contains "Option A"
// Change TextBoxField to see if this works as expected
text1.setValue('Test 123');
text1Value = text1.getValue();
// text1Value contains "Test 123"
// Change ComboBoxField to select other option
dropdown1.setValue('Option C');
dropdown1Value = dropdown1.getValue();
// dropdown1Value contains "þÿOption C" (utf-16 encoded with utf-16 BOM)
// Change ComboBoxField to a value that is not included in the options
dropdown1.setValue('Option X');
dropdown1Value = dropdown1.getValue();
// dropdown1Value contains "Option X"
I'm using aspose PDF 11.9