public virtual void TopIndexTest()
        {
            String             srcPdf   = sourceFolder + "choiceFieldNotFittingTest.pdf";
            String             outPdf   = destinationFolder + "topIndexTest.pdf";
            String             cmpPdf   = sourceFolder + "cmp_topIndexTest.pdf";
            PdfDocument        document = new PdfDocument(new PdfReader(srcPdf), new PdfWriter(outPdf));
            PdfAcroForm        form     = PdfAcroForm.GetAcroForm(document, false);
            PdfChoiceFormField field    = (PdfChoiceFormField)form.GetField("choice");

            field.SetListSelected(new String[] { "seven" });
            int topIndex = field.GetIndices().GetAsNumber(0).IntValue();

            field.SetTopIndex(topIndex);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder));
        }
        public virtual void PdfA1DocWithPdfA1ListFieldTest()
        {
            String  name         = "pdfA1DocWithPdfA1ListField";
            String  fileName     = destinationFolder + name + ".pdf";
            String  cmp          = sourceFolder + "cmp/PdfAFormFieldTest/cmp_pdfA1DocWithPdfA1ListField.pdf";
            PdfFont fontFreeSans = PdfFontFactory.CreateFont(sourceFolder + "FreeSans.ttf", "WinAnsi", true);
            Stream  @is          = new FileStream(sourceFolder + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read);
            PdfAConformanceLevel conformanceLevel = PdfAConformanceLevel.PDF_A_1B;
            PdfADocument         pdfDoc           = new PdfADocument(new PdfWriter(fileName), conformanceLevel, new PdfOutputIntent("Custom"
                                                                                                                                    , "", "http://www.color.org", "sRGB IEC61966-2.1", @is));
            PdfAcroForm        form = PdfAcroForm.GetAcroForm(pdfDoc, true);
            PdfChoiceFormField f    = PdfFormField.CreateList(pdfDoc, new Rectangle(86, 556, 50, 200), "list", "9", new String
                                                              [] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, fontFreeSans, conformanceLevel);

            f.SetValue("4");
            f.SetTopIndex(2);
            f.SetListSelected(new String[] { "3", "5" });
            form.AddField(f);
            pdfDoc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(fileName, cmp, destinationFolder));
            NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(fileName));
        }