iTextSharp.text.pdf.TextField.GetListField C# (CSharp) Метод

GetListField() публичный Метод

public GetListField ( ) : PdfFormField
Результат PdfFormField
        public PdfFormField GetListField() {
            return GetChoiceField(true);
        }

Usage Example

Пример #1
0
        private void VisibleTopChoiceHelper(int topVisible, int expected, String file) {
            Document document = new Document();
            FileStream fos = new FileStream(OUTPUT_FOLDER + file, FileMode.Create);
            PdfWriter writer = PdfWriter.GetInstance(document, fos);
            document.Open();

            TextField textField = new TextField(writer, new Rectangle(380, 560, 500, 610), "testListBox");

            textField.Visibility = BaseField.VISIBLE;
            textField.Rotation = 0;

            textField.FontSize = 14f;
            textField.TextColor = BaseColor.MAGENTA;

            textField.BorderColor = BaseColor.BLACK;
            textField.BorderStyle = PdfBorderDictionary.STYLE_SOLID;

            textField.Font = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.WINANSI, BaseFont.EMBEDDED);
            textField.BorderWidth = BaseField.BORDER_WIDTH_THIN;

            writer.RunDirection = PdfWriter.RUN_DIRECTION_LTR;

            textField.Choices = new String[] {"one", "two", "three"};
            textField.ChoiceExports = new String[] {"1", "2", "3"};

            //choose the second item
            textField.ChoiceSelection = 1;
            //set the first item as the visible one
            textField.VisibleTopChoice = topVisible;

            Assert.AreEqual(expected, textField.VisibleTopChoice);

            PdfFormField field = textField.GetListField();

            writer.AddAnnotation(field);

            document.Close();

            // compare
            CompareTool compareTool = new CompareTool();
            String errorMessage = compareTool.CompareByContent(OUTPUT_FOLDER + file, CMP_FOLDER + file, OUTPUT_FOLDER, "diff");
            if (errorMessage != null) {
                Assert.Fail(errorMessage);
            }
        }
All Usage Examples Of iTextSharp.text.pdf.TextField::GetListField