Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
AddListItem method allows you to add an item in a ListBox field. The first argument is the field name and second argument in the field item. You can either pass a single field item or you can pass an array of string contains a list of items. This method is provided by FormEditor class. The following code snippet shows you how to add list items in a PDF file.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddListItem()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of FormEditor to manipulate form fields
using (var formEditor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
formEditor.BindPdf(dataDir + "Sample-Form-01.pdf");
// Add a ListBox field for selecting country, placed at the specified coordinates on page 1
formEditor.AddField(Aspose.Pdf.Facades.FieldType.ListBox, "Country", 1, 232.56f, 476.75f, 352.28f,
514.03f);
// Add list items to the 'Country' ListBox field
formEditor.AddListItem("Country", "USA");
formEditor.AddListItem("Country", "Canada");
formEditor.AddListItem("Country", "France");
formEditor.AddListItem("Country", "Spain");
// Save PDF document
formEditor.Save(dataDir + "Sample-Form-01-mod.pdf");
}
}
DelListItem method allows you to delete a particular item from the ListBox. The first parameter is the field name while second parameter is the item which you want to delete from the list. This method is provided by FormEditor class. The following code snippet shows you how to delete a list item from the PDF file.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void DelListItem()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of FormEditor to manipulate form fields
using (var formEditor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
formEditor.BindPdf(dataDir + "Sample-Form-04.pdf");
// Delete the list item "France" from the 'Country' ListBox field
formEditor.DelListItem("Country", "France");
// Save PDF document
formEditor.Save(dataDir + "Sample-Form-04-mod.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.