menu

ASP.NET Core

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfComboBoxField

    Show / Hide Table of Contents

    Class PdfComboBoxField

    Represents combo box field in the PDF Form.

    Inheritance
    System.Object
    PdfField
    PdfStyledField
    PdfAppearanceField
    PdfListField
    PdfComboBoxField
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    PdfListField.Items
    PdfListField.SelectedIndex
    PdfListField.SelectedValue
    PdfListField.SelectedItem
    PdfAppearanceField.Appearance
    PdfStyledField.ObtainFont()
    PdfStyledField.DefineDefaultAppearance()
    PdfStyledField.Bounds
    PdfStyledField.Visibility
    PdfStyledField.Location
    PdfStyledField.RotationAngle
    PdfStyledField.Size
    PdfStyledField.BorderColor
    PdfStyledField.BackColor
    PdfStyledField.ForeColor
    PdfStyledField.BorderWidth
    PdfStyledField.HighlightMode
    PdfStyledField.Font
    PdfStyledField.TextAlignment
    PdfStyledField.Actions
    PdfStyledField.BorderStyle
    PdfStyledField.Visible
    PdfField.Name
    PdfField.Form
    PdfField.MappingName
    PdfField.Export
    PdfField.ReadOnly
    PdfField.Required
    PdfField.ToolTip
    PdfField.Page
    PdfField.Flatten
    PdfField.DisableAutoFormat
    PdfField.PdfTag
    PdfField.TabIndex
    PdfField.Layer
    PdfField.PropertyChanged
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Pdf.Interactive
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfComboBoxField : PdfListField, IPdfWrapper, INotifyPropertyChanged
    Remarks

    This PdfComboBoxField class is used to create the combo box field in PDF forms. Please refer the UG docuemntation link for more details.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);          
    //Create a combo box
    PdfComboBoxField positionComboBox = new PdfComboBoxField(page, "positionComboBox");   
    positionComboBox.Bounds = new RectangleF(100, 115, 200, 20);
    positionComboBox.Font = font;
    positionComboBox.Editable = true;
    //Add it to document
    document.Form.Fields.Add(positionComboBox);
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As PdfDocument = New PdfDocument()
    'Create a page
    Dim page As PdfPage = document.Pages.Add()
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
    'Create a combo box
    Dim positionComboBox As PdfComboBoxField = New PdfComboBoxField(page, "positionComboBox") 
    positionComboBox.Bounds = New RectangleF(100, 115, 200, 20)
    positionComboBox.Font = font
    positionComboBox.Editable = True
    'Add it to document
    document.Form.Fields.Add(positionComboBox)
    document.Save("Form.pdf")
    document.Close(True)

    Constructors

    PdfComboBoxField(PdfPageBase, String)

    Initializes a new instance of the PdfComboBoxField class with the specific page and name.

    Declaration
    public PdfComboBoxField(PdfPageBase page, string name)
    Parameters
    Type Name Description
    PdfPageBase page

    Page of the field to be placed on.

    System.String name

    The name of the field.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);          
    //Create a combo box
    PdfComboBoxField positionComboBox = new PdfComboBoxField(page, "positionComboBox");    
    positionComboBox.Bounds = new RectangleF(100, 115, 200, 20);
    positionComboBox.Font = font;
    positionComboBox.Editable = true;
    //Add it to document
    document.Form.Fields.Add(positionComboBox);
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As PdfDocument = New PdfDocument()
    'Create a page
    Dim page As PdfPage = document.Pages.Add()
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
    'Create a combo box
    Dim positionComboBox As PdfComboBoxField = New PdfComboBoxField(page, "positionComboBox")     
    positionComboBox.Bounds = New RectangleF(100, 115, 200, 20)
    positionComboBox.Font = font
    positionComboBox.Editable = True
    'Add it to document
    document.Form.Fields.Add(positionComboBox)
    document.Save("Form.pdf")
    document.Close(True)
    See Also
    PdfStyledField
    PdfPage
    PdfDocument
    PdfFont

    Properties

    ComplexScript

    Gets or sets the complex script language support.

    Declaration
    public bool ComplexScript { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a new PDF page.
    PdfPage page = document.Pages.Add();
    //Create font.
    Font font = new Font("Tahoma", 10f);
    //Create a new PDF font instance.
    PdfFont pdfFont = new PdfTrueTypeFont(font, FontStyle.Regular, 10f, true, true);
    //Create a new combo box field.
    PdfComboBoxField comboBox = new PdfComboBoxField(page, "combo");
    //Set bounds
    comboBox.Bounds = new RectangleF(0, 0, 300, 20);
    //Set font.
    comboBox.Font = pdfFont;
    //Add items.
    comboBox.Items.Add(new PdfListFieldItem("สวัสดีชาวโลก", "One"));
    comboBox.Items.Add(new PdfListFieldItem("สวัสดีชาวโลก", "Two"));
    //Set selected index.
    comboBox.SelectedIndex = 0;
    //Enable complex script.
    comboBox.ComplexScript = true;
    //Add field to form.
    document.Form.Fields.Add(comboBox);
    document.Form.SetDefaultAppearance(false);
    //Save the document.
    document.Save("output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a new PDF page.
    Dim page As PdfPage = document.Pages.Add()
    'Create font.
    Dim font As New Font("Tahoma", 10F)
    'Create a new PDF font instance.
    Dim pdfFont As PdfFont = New PdfTrueTypeFont(font, FontStyle.Regular, 10F, True, True)
    'Create a new combo box field.
    Dim comboBox As New PdfComboBoxField(page, "combo")
    'Set bounds
    comboBox.Bounds = New RectangleF(0, 0, 300, 20)
    'Set font.
    comboBox.Font = pdfFont
    'Add items.
    comboBox.Items.Add(New PdfListFieldItem("สวัสดีชาวโลก", "One"))
    comboBox.Items.Add(New PdfListFieldItem("สวัสดีชาวโลก", "Two"))
    'Set selected index.
    comboBox.SelectedIndex = 0
    'Enable complex script.
    comboBox.ComplexScript = True
    'Add field to form.
    document.Form.Fields.Add(comboBox)
    document.Form.SetDefaultAppearance(False)
    'Save the document.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Editable

    Gets or sets a value indicating whether this PdfComboBoxField is editable.

    Declaration
    public bool Editable { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if editable; otherwise, false.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);          
    //Create a combo box
    PdfComboBoxField positionComboBox = new PdfComboBoxField(page, "positionComboBox");
    positionComboBox.Editable = true
    positionComboBox.Bounds = new RectangleF(100, 115, 200, 20);
    positionComboBox.Font = font;
    positionComboBox.Editable = true;
    //Add it to document
    document.Form.Fields.Add(positionComboBox);
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As PdfDocument = New PdfDocument()
    'Create a page
    Dim page As PdfPage = document.Pages.Add()
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
    'Create a combo box
    Dim positionComboBox As PdfComboBoxField = New PdfComboBoxField(page, "positionComboBox")        
    positionComboBox.Editable = True
    positionComboBox.Bounds = New RectangleF(100, 115, 200, 20)
    positionComboBox.Font = font
    positionComboBox.Editable = True
    'Add it to document
    document.Form.Fields.Add(positionComboBox)
    document.Save("Form.pdf")
    document.Close(True)
    See Also
    PdfStyledField
    PdfPage
    PdfDocument
    PdfFont

    Methods

    DrawAppearance(PdfTemplate)

    Draws the appearance.

    Declaration
    protected override void DrawAppearance(PdfTemplate template)
    Parameters
    Type Name Description
    PdfTemplate template

    The template.

    Overrides
    PdfAppearanceField.DrawAppearance(PdfTemplate)

    Initialize()

    Initializes an instance.

    Declaration
    protected override void Initialize()
    Overrides
    PdfListField.Initialize()

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    PdfListField
    PdfStyledField
    PdfPage
    PdfDocument
    PdfFont
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved