How To Add ListBox To PDF Document In PDF Mosiac .NET SDK

This sample shows how to use list boxes in your PDF document.
Use PDFListBox class to add a list box.

PDF list box

 

using PDFMosaic;
using System;

namespace ListBox
{
    class ListBox
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();
            PDFPage page = new PDFPage(PDFPaperFormat.A4);

            PDFListBox listBox = new PDFListBox(20, 40, 50, 70, "listBox1");
            listBox.Items.Add("Value 1");
            listBox.Items.Add("Value 2");
            listBox.Items.Add("Value 3");
            listBox.Items.Add("Value 4");
            listBox.BorderColor = new PDFColorRGB(255, 0, 0);
            listBox.BackgroundColor = new PDFColorRGB(0, 255, 0);

            page.Annotations.Add(listBox);

            document.Pages.Add(page);
            document.Save("ListBox.pdf", true);
        }
    }
}