Class PdfField
Represents field of the PDF document's interactive form.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public abstract class PdfField : IPdfWrapper, INotifyPropertyChanged
Constructors
PdfField(PdfPageBase, String)
Initializes a new instance of the PdfField class with the specific page and name.
Declaration
public PdfField(PdfPageBase page, string name)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The page where the field should be placed. |
System.String | name | The name. |
Properties
DisableAutoFormat
Gets or sets a value indicating whether to disable auto format this PdfField.
Declaration
public bool DisableAutoFormat { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Export
Gets or sets a value indicating whether this PdfField is export.
Declaration
public virtual bool Export { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Flatten
Gets or sets a value indicating whether to flatten this PdfField.
Declaration
public bool Flatten { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Form
Gets the form of the PdfField.[Read-Only]
Declaration
public virtual PdfForm Form { get; }
Property Value
Type | Description |
---|---|
PdfForm | The form. |
Layer
Gets or sets the PdfLayer to the AcroForm fields
Declaration
public PdfLayer Layer { get; set; }
Property Value
Type | Description |
---|---|
PdfLayer |
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();
//Creates a PdfLayer
PdfLayer layer = document.Layers.Add("Hello");
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
//Create a text box
PdfTextBoxField firstNameTextBox = new PdfTextBoxField(page, "firstNameTextBox");
firstNameTextBox.Bounds = new RectangleF(100, 20, 200, 20);
firstNameTextBox.Font = font;
//Set layer to text box field
firstNameTextBox.Layer = layer;
page.Graphics.DrawString("First Name", font, PdfBrushes.Black, 10, 55);
//Add the textbox in document
document.Form.Fields.Add(firstNameTextBox);
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()
'Creates a PdfLayer
Dim layer As PdfLayer = document.Layers.Add("Hello")
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
'Create a text box
Dim firstNameTextBox As PdfTextBoxField = New PdfTextBoxField(page, "firstNameTextBox")
firstNameTextBox.Bounds = New RectangleF(100, 20, 200, 20)
firstNameTextBox.Font = font
'Set layer to text box field
firstNameTextBox.Layer = layer
page.Graphics.DrawString("First Name", font, PdfBrushes.Black, 10, 55)
'Add the textbox in document
document.Form.Fields.Add(firstNameTextBox)
document.Save("Form.pdf")
document.Close(True)
MappingName
Gets or sets the mapping name to be used when exporting interactive form field data from the document.
Declaration
public virtual string MappingName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The mapping name. |
Name
Gets the name of the PdfField.[Read-Only]
Declaration
public virtual string Name { get; }
Property Value
Type | Description |
---|---|
System.String | The name. |
Page
Gets the page of the field.[Read-Only]
Declaration
public virtual PdfPageBase Page { get; }
Property Value
Type | Description |
---|---|
PdfPageBase | The page. |
PdfTag
Get or set tag for the field
Declaration
public PdfTag PdfTag { get; set; }
Property Value
Type | Description |
---|---|
PdfTag |
ReadOnly
Gets or sets a value indicating whether this PdfField field is read-only.
Declaration
public virtual bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | if the field is read only, set to |
Required
Gets or sets a value indicating whether this PdfField is required.
Declaration
public virtual bool Required { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
TabIndex
Gets or sets the tab index for form fields
Declaration
public int TabIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ToolTip
Gets or sets the tool tip.
Declaration
public virtual string ToolTip { get; set; }
Property Value
Type | Description |
---|---|
System.String | The tool tip. |
Methods
DefineDefaultAppearance()
Defines default appearance.
Declaration
protected virtual void DefineDefaultAppearance()
Initialize()
Initializes this instance.
Declaration
protected virtual void Initialize()
Events
PropertyChanged
The event will rise when form field properties have been changed.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
System.ComponentModel.PropertyChangedEventHandler |