public static void Main(string[] args) { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); // create Document object Document doc = new Document(); // add page to document object doc.Pages.Add(); // instantiate ComboBox Field object ComboBoxField combo = new ComboBoxField(doc.Pages[1], new Aspose.Pdf.Rectangle(100, 600, 150, 616)); // add option to ComboBox combo.AddOption("Red"); combo.AddOption("Yellow"); combo.AddOption("Green"); combo.AddOption("Blue"); // add combo box object to form fields collection of document object doc.Form.Add(combo); // save the PDF document doc.Save(dataDir + "output.pdf"); }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // create Document object Document doc = new Document(); // add page to document object doc.Pages.Add(); // instantiate ComboBox Field object ComboBoxField combo = new ComboBoxField(doc.Pages[1], new Aspose.Pdf.Rectangle(100, 600, 150, 616)); // add option to ComboBox combo.AddOption("Red"); combo.AddOption("Yellow"); combo.AddOption("Green"); combo.AddOption("Blue"); // add combo box object to form fields collection of document object doc.Form.Add(combo); // save the PDF document doc.Save(dataDir + "ComboBox_out.pdf"); }
public static void Run() { try { // ExStart:ComboBox // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // Create Document object Document doc = new Document(); // Add page to document object doc.Pages.Add(); // Instantiate ComboBox Field object ComboBoxField combo = new ComboBoxField(doc.Pages[1], new Aspose.Pdf.Rectangle(100, 600, 150, 616)); // Add option to ComboBox combo.AddOption("Red"); combo.AddOption("Yellow"); combo.AddOption("Green"); combo.AddOption("Blue"); // Add combo box object to form fields collection of document object doc.Form.Add(combo); dataDir = dataDir + "ComboBox_out_.pdf"; // Save the PDF document doc.Save(dataDir); // ExEnd:ComboBox Console.WriteLine("\nCombobox field added successfully.\nFile saved at " + dataDir); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Run() { try { // ExStart:ComboBox // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // Create Document object Document doc = new Document(); // Add page to document object doc.Pages.Add(); // Instantiate ComboBox Field object ComboBoxField combo = new ComboBoxField(doc.Pages[1], new Aspose.Pdf.Rectangle(100, 600, 150, 616)); // Add option to ComboBox combo.AddOption("Red"); combo.AddOption("Yellow"); combo.AddOption("Green"); combo.AddOption("Blue"); // Add combo box object to form fields collection of document object doc.Form.Add(combo); dataDir = dataDir + "ComboBox_out.pdf"; // Save the PDF document doc.Save(dataDir); // ExEnd:ComboBox Console.WriteLine("\nCombobox field added successfully.\nFile saved at " + dataDir); } catch (Exception ex) { Console.WriteLine(ex.Message); } }