PDF Mosaic: How to add ComboBox to PDF document


Home       Features       Download       Tutorial       Version History       License       Source Code

 

This sample shows how to use combo boxes in your PDF document.

Use PDFComboBox class to add a combo box.


 

using PDFMosaic;
using System;
 
namespace ComboBoxes
{
    class ComboBoxes
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();
            PDFPage page = new PDFPage(PDFPaperFormat.A4);
 
            PDFComboBox comboBox1 = new PDFComboBox(10, 40, 100, 20, "comboBox1");
            comboBox1.BorderColor = new PDFColorRGB(255, 0, 0);
            comboBox1.Font.Size = 8;
            comboBox1.Text = "Select item";
            comboBox1.Items.Add("First item");
            comboBox1.Items.Add("Second item");
            comboBox1.Items.Add("Third item");
 
            PDFComboBox comboBox2 = new PDFComboBox(10, 70, 100, 20, "comboBox2");
            comboBox2.BackgroundColor = new PDFColorRGB(0, 255, 0);
            comboBox2.Font.Size = 8;
            comboBox2.Editable = true;
            comboBox2.Text = "Editable combo box";
            comboBox2.Items.Add("First item");
            comboBox2.Items.Add("Second item");
 
            page.Annotations.Add(comboBox1);
            page.Annotations.Add(comboBox2);
 
            document.Pages.Add(page);
            document.Save("ComboBoxes.pdf", true);
        }
    }
}

 


Home       Features       Download       Tutorial       Version History       License       Source Code