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

Free Support Forum - aspose.com

Adding ComboBox to Pdf.Form and setting its value and other properties

When I use your example to add a comboBox and add its items, the comboBox value is not being set (the debugger reports "null").

In the code below, "field" is a TextBox. I want to replace it with a comboBox and set the comboBox's value to "Jeff."

pdfDocument.Form.Delete(field);

FormEditor formEditor = new FormEditor();
formEditor.BindPdf(pdfDocument);
formEditor.AddField(FieldType.ComboBox, field.FullName, "Jeff", page, (float)field.Rect.LLX, (float)field.Rect.LLY, (float)field.Rect.URX, (float)field.Rect.URY);

//add list items
formEditor.AddListItem(field.FullName, "Jeff"); //field.Value);
formEditor.AddListItem(field.FullName, "Some prior value");
this.pictureBoxPDFPage.Image = Utilities.PDFGetPageThumbnail(pdfDocument, thumbnailSize, page);

pdfDocument.Save("C:\\Junk\\ComboBox.pdf");

Note: The page image does not show a comboBox. It just looks like a blank spot in the document. Plus, there is no value.

I opened the saved document in Acrobat Pro. The comboBox is there. It has no border. I want a border, too. The items were there. The value is not set, and therefore, it is null.

How can I get:

1. The value to be set,
2. A border, and
3. The page image to show the comboBox?

Thanks.

Hi Jeff,


Thanks for using our API’s.

Can you please share the resource PDF forms, so that we can test the scenario in our environment. We are sorry for this inconvenience.