iText 8.0.5 API
iText.Forms.Fields.PdfFormField Class Reference

This class represents a single field or field group in an AcroForm. More...

Inheritance diagram for iText.Forms.Fields.PdfFormField:
iText.Forms.Fields.AbstractPdfFormField iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary > iText.Forms.Fields.PdfButtonFormField iText.Forms.Fields.PdfChoiceFormField iText.Forms.Fields.PdfSignatureFormField iText.Forms.Fields.PdfTextFormField

Public Member Functions

  PdfFormField (PdfDictionary pdfObject)
  Creates a form field as a wrapper object around a iText.Kernel.Pdf.PdfDictionary. More...
 
virtual PdfName  GetFormType ()
  Returns the type of the parent form field, or of the wrapped object. More...
 
virtual iText.Forms.Fields.PdfFormField  SetValue (String value)
  Sets a value to the field and generating field appearance if needed. More...
 
virtual iText.Forms.Fields.PdfFormField  SetValue (String value, bool generateAppearance)
  Sets a value to the field (and fields with the same names) and generates field appearance if needed. More...
 
virtual iText.Forms.Fields.PdfFormField  SetValue (String value, PdfFont font, float fontSize)
  Set text field value with given font and size. More...
 
virtual iText.Forms.Fields.PdfFormField  SetValue (String value, String displayValue)
  Sets the field value and the display string. More...
 
virtual void  RemoveChild (AbstractPdfFormField fieldName)
  Removes the childField object of this field. More...
 
virtual void  RemoveChildren ()
  Removes all children from the current field. More...
 
virtual PdfArray  GetKids ()
  Gets the kids of this object. More...
 
virtual IList< AbstractPdfFormField GetChildFields ()
  Gets the childFields of this object. More...
 
virtual IList< iText.Forms.Fields.PdfFormField GetChildFormFields ()
  Gets all child form fields of this form field. More...
 
virtual IList< iText.Forms.Fields.PdfFormField GetAllChildFormFields ()
  Gets all childFields of this object, including the children of the children but not annotations. More...
 
virtual IList< AbstractPdfFormField GetAllChildFields ()
  Gets all childFields of this object, including the children of the children. More...
 
virtual iText.Forms.Fields.PdfFormField  GetChildField (String fieldName)
  Gets the child field of form field. More...
 
virtual iText.Forms.Fields.PdfFormField  AddKid (AbstractPdfFormField kid)
  Adds a new kid to the Kids array property from a AbstractPdfFormField. More...
 
virtual iText.Forms.Fields.PdfFormField  AddKid (AbstractPdfFormField kid, bool throwExceptionOnError)
  Adds a new kid to the Kids array property from a AbstractPdfFormField. More...
 
virtual iText.Forms.Fields.PdfFormField  AddKid (PdfWidgetAnnotation kid)
  Adds a new kid to the Kids array property from a iText.Kernel.Pdf.Annot.PdfWidgetAnnotation. More...
 
virtual iText.Forms.Fields.PdfFormField  SetFieldName (String name)
  Changes the name of the field to the specified value. More...
 
virtual PdfString  GetPartialFieldName ()
  Gets the current field partial name. More...
 
virtual iText.Forms.Fields.PdfFormField  SetAlternativeName (String name)
  Changes the alternate name of the field to the specified value. More...
 
virtual PdfString  GetAlternativeName ()
  Gets the current alternate name. More...
 
virtual iText.Forms.Fields.PdfFormField  SetMappingName (String name)
  Changes the mapping name of the field to the specified value. More...
 
virtual PdfString  GetMappingName ()
  Gets the current mapping name. More...
 
virtual bool  GetFieldFlag (int flag)
  Checks whether a certain flag, or any of a combination of flags, is set for this form field. More...
 
virtual iText.Forms.Fields.PdfFormField  SetFieldFlag (int flag)
  Adds a flag, or combination of flags, for the form field. More...
 
virtual iText.Forms.Fields.PdfFormField  SetFieldFlag (int flag, bool value)
  Adds or removes a flag, or combination of flags, for the form field. More...
 
virtual bool  IsMultiline ()
  If true, the field can contain multiple lines of text; if false, the field's text is restricted to a single line. More...
 
virtual bool  IsPassword ()
  If true, the field is intended for entering a secure password that should not be echoed visibly to the screen. More...
 
virtual iText.Forms.Fields.PdfFormField  SetFieldFlags (int flags)
  Sets a flag, or combination of flags, for the form field. More...
 
virtual int  GetFieldFlags ()
  Gets the current list of PDF form field flags. More...
 
virtual PdfObject  GetValue ()
  Gets the current value contained in the form field. More...
 
virtual String  GetValueAsString ()
  Gets the current value contained in the form field. More...
 
virtual String  GetDisplayValue ()
  Gets the current display value of the form field. More...
 
virtual iText.Forms.Fields.PdfFormField  SetDefaultValue (PdfObject value)
  Sets the default fallback value for the form field. More...
 
virtual PdfObject  GetDefaultValue ()
  Gets the default fallback value for the form field. More...
 
virtual iText.Forms.Fields.PdfFormField  SetAdditionalAction (PdfName key, PdfAction action)
  Sets an additional action for the form field. More...
 
virtual PdfDictionary  GetAdditionalAction ()
  Gets the currently additional action dictionary for the form field. More...
 
virtual iText.Forms.Fields.PdfFormField  SetOptions (PdfArray options)
  Sets options for the form field. More...
 
virtual PdfArray  GetOptions ()
  Gets options for the form field. More...
 
virtual IList< PdfWidgetAnnotation GetWidgets ()
  Gets all iText.Kernel.Pdf.Annot.PdfWidgetAnnotation that its children refer to. More...
 
virtual IList< PdfFormAnnotation GetChildFormAnnotations ()
  Gets all child form field's annotations PdfFormAnnotation of this form field. More...
 
virtual PdfFormAnnotation  GetFirstFormAnnotation ()
  Gets a single child form field's annotation PdfFormAnnotation. More...
 
override PdfString  GetDefaultAppearance ()
  Gets default appearance string containing a sequence of valid page-content graphics or text state operators that define such properties as the field's text size and color. More...
 
virtual void  UpdateDefaultAppearance ()
  Updates DA for Variable text, Push button and choice form fields. More...
 
virtual ? TextAlignment  GetJustification ()
  Gets a code specifying the form of quadding (justification) to be used in displaying the text: 0 Left-justified 1 Centered 2 Right-justified More...
 
virtual iText.Forms.Fields.PdfFormField  SetJustification (TextAlignment? justification)
  Sets a code specifying the form of quadding (justification) to be used in displaying the text: 0 Left-justified 1 Centered 2 Right-justified More...
 
virtual PdfString  GetDefaultStyle ()
  Gets a default style string, as described in "Rich Text Strings" section of Pdf spec. More...
 
virtual iText.Forms.Fields.PdfFormField  SetDefaultStyle (PdfString defaultStyleString)
  Sets a default style string, as described in "Rich Text Strings" section of Pdf spec. More...
 
virtual PdfObject  GetRichText ()
  Gets a rich text string, as described in "Rich Text Strings" section of Pdf spec. More...
 
virtual iText.Forms.Fields.PdfFormField  SetRichText (PdfObject richText)
  Sets a rich text string, as described in "Rich Text Strings" section of Pdf spec. More...
 
virtual iText.Forms.Fields.PdfFormField  SetCheckType (CheckBoxType checkType)
  Changes the type of graphical marker used to mark a checkbox as 'on'. More...
 
override bool  RegenerateField ()
  This method regenerates appearance stream of the field. More...
 
virtual iText.Forms.Fields.PdfFormField  SetReadOnly (bool readOnly)
  Sets the ReadOnly flag, specifying whether or not the field can be changed. More...
 
virtual bool  IsReadOnly ()
  Gets the ReadOnly flag, specifying whether or not the field can be changed. More...
 
virtual iText.Forms.Fields.PdfFormField  SetRequired (bool required)
  Sets the Required flag, specifying whether or not the field must be filled in. More...
 
virtual bool  IsRequired ()
  Gets the Required flag, specifying whether or not the field must be filled in. More...
 
virtual iText.Forms.Fields.PdfFormField  SetNoExport (bool noExport)
  Sets the NoExport flag, specifying whether or not exporting is forbidden. More...
 
virtual bool  IsNoExport ()
  Gets the NoExport attribute. More...
 
virtual bool  IsInReadingMode ()
  Checks if the document that contains the field is created in reading mode. More...
 
override String[]  GetAppearanceStates ()
  Gets the appearance state names. More...
 
override void  Release ()
  Releases underlying pdf object and other pdf entities used by wrapper. More...
 
override AbstractPdfFormField  SetColor (Color color)
  Sets the text color and regenerates appearance stream. More...
 
- Public Member Functions inherited from iText.Forms.Fields.AbstractPdfFormField
override PdfDictionary  GetPdfObject ()
  Gets the wrapped dictionary. More...
 
virtual void  SetParent (PdfFormField parent)
  Sets a parent PdfFormField for the current object. More...
 
virtual PdfDictionary  GetParent ()
  Gets the parent dictionary. More...
 
virtual PdfFormField  GetParentField ()
  Gets the parent field. More...
 
virtual PdfString  GetFieldName ()
  Gets the current field name. More...
 
virtual float  GetFontSize ()
  Gets the current fontSize of the form field. More...
 
virtual PdfFont  GetFont ()
  Gets the current font of the form field. More...
 
virtual Color  GetColor ()
  Gets the current color of the form field. More...
 
virtual PdfAConformanceLevel  GetPdfAConformanceLevel ()
  Gets the declared conformance level. More...
 
virtual IConformanceLevel  GetPdfConformanceLevel ()
  Gets the declared conformance level. More...
 
virtual void  DisableFieldRegeneration ()
  This method disables regeneration of the field and its children appearance stream. More...
 
virtual void  EnableFieldRegeneration ()
  This method enables regeneration of the field appearance stream. More...
 
virtual void  DisableCurrentFieldRegeneration ()
  This method disables regeneration of the current field appearance stream. More...
 
virtual void  EnableCurrentFieldRegeneration ()
  This method enables regeneration of the current field appearance stream and regenerates it. More...
 
virtual bool  IsFieldRegenerationEnabled ()
  This method checks if field appearance stream regeneration is enabled. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  Put (PdfName key, PdfObject value)
  Inserts the value into the iText.Kernel.Pdf.PdfDictionary of this field and associates it with the specified key. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  Remove (PdfName key)
  Removes the specified key from the iText.Kernel.Pdf.PdfDictionary of this field. More...
 
virtual PdfDocument  GetDocument ()
  Gets the iText.Kernel.Pdf.PdfDocument that owns that form field. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  SetFont (PdfFont font)
  Basic setter for the font property. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  SetFontSize (float fontSize)
  Basic setter for the fontSize property. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  SetFontSize (int fontSize)
  Basic setter for the fontSize property. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  SetFontSizeAutoScale ()
  Sets zero font size which will be interpreted as auto-size according to ISO 32000-1, 12.7.3.3. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  SetFontAndSize (PdfFont font, float fontSize)
  Combined setter for the font and fontSize properties. More...
 
virtual bool  IsTerminalFormField ()
  Determines whether current form field is terminal or not. More...
 
override bool  Equals (Object o)
  Indicate whether some other object is "equal to" this one. More...
 
override int  GetHashCode ()
  Generate a hash code for this object. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document, PdfIndirectReference reference)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  SetModified ()
 
virtual void  Flush ()
 
virtual bool  IsFlushed ()
 

Static Public Member Functions

static iText.Forms.Fields.PdfFormField  MakeFormField (PdfObject pdfObject, PdfDocument document)
  Creates a (subtype of) PdfFormField object. More...
 
static AbstractPdfFormField  MakeFormFieldOrAnnotation (PdfObject pdfObject, PdfDocument document)
  Creates a (subtype of) PdfFormField or PdfFormAnnotation object depending on pdfObject. More...
 
static int  MakeFieldFlag (int bitPosition)
  Makes a field flag by bit position. More...
 
static bool  IsFormField (PdfDictionary dict)
  Checks if dictionary contains any of the form field keys. More...
 
static ICollection< PdfName GetFormFieldKeys ()
  Gets a set of all possible form field keys except PdfName.Parent. More...
 
static PdfName  GetFormType (PdfDictionary fieldDict)
  Returns the type of the form field dictionary, or of the parent object. More...
 

Static Public Attributes

static readonly int  FF_MULTILINE = MakeFieldFlag(13)
  Flag that designates, if set, that the field can contain multiple lines of text. More...
 
static readonly int  FF_PASSWORD = MakeFieldFlag(14)
  Flag that designates, if set, that the field's contents must be obfuscated. More...
 
static readonly int  FF_READ_ONLY = MakeFieldFlag(1)
  The ReadOnly flag, which specifies whether or not the field can be changed. More...
 
static readonly int  FF_REQUIRED = MakeFieldFlag(2)
  The Required flag, which specifies whether or not the field must be filled in. More...
 
static readonly int  FF_NO_EXPORT = MakeFieldFlag(3)
  The NoExport flag, which specifies whether or not exporting is forbidden. More...
 
- Static Public Attributes inherited from iText.Forms.Fields.AbstractPdfFormField
const int  DEFAULT_FONT_SIZE = 12
  Size of text in form fields when font size is not explicitly set. More...
 
const int  MIN_FONT_SIZE = 4
  Minimal size of text in form fields. More...
 

Package Functions

  PdfFormField (PdfDocument pdfDocument)
  Creates a minimal PdfFormField. More...
 
  PdfFormField (PdfWidgetAnnotation widget, PdfDocument pdfDocument)
  Creates a form field as a parent of a iText.Kernel.Pdf.Annot.PdfWidgetAnnotation. More...
 
- Package Functions inherited from iText.Forms.Fields.AbstractPdfFormField
  AbstractPdfFormField (PdfDictionary pdfObject)
  Creates a form field as a wrapper object around a iText.Kernel.Pdf.PdfDictionary. More...
 
- Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
  PdfObjectWrapper (T pdfObject)
 
virtual void  SetPdfObject (T pdfObject)
 
virtual void  SetForbidRelease ()
 
virtual void  UnsetForbidRelease ()
 
virtual void  EnsureUnderlyingObjectHasIndirectReference ()
 

Package Attributes

String  text
 
ImageData  img
 
PdfFormXObject  form
 
NullableContainer< CheckBoxType checkType = null
 
- Package Attributes inherited from iText.Forms.Fields.AbstractPdfFormField
PdfFont  font
 
float  fontSize = -1
 
Color  color
 
PdfAConformanceLevel  pdfAConformanceLevel
 
IConformanceLevel  pdfConformanceLevel
 
PdfFormField  parent
  Parent form field. More...
 

Additional Inherited Members

- Protected Member Functions inherited from iText.Forms.Fields.AbstractPdfFormField
override bool  IsWrappedObjectMustBeIndirect ()
  Defines if the object behind this wrapper must be an indirect object in the resultant document. More...
 
- Static Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
static void  MarkObjectAsIndirect (PdfObject pdfObject)
 
static void  EnsureObjectIsAddedToDocument (PdfObject @object)
  Some wrappers use object's indirect reference to obtain the PdfDocument to which the object belongs to. More...
 

Detailed Description

This class represents a single field or field group in an AcroForm.

This class represents a single field or field group in an AcroForm.

To be able to be wrapped with this iText.Kernel.Pdf.PdfObjectWrapper the iText.Kernel.Pdf.PdfObject must be indirect.

Constructor & Destructor Documentation

◆ PdfFormField() [1/3]

iText.Forms.Fields.PdfFormField.PdfFormField ( PdfDictionary  pdfObject )
inline

Creates a form field as a wrapper object around a iText.Kernel.Pdf.PdfDictionary.

Creates a form field as a wrapper object around a iText.Kernel.Pdf.PdfDictionary. This iText.Kernel.Pdf.PdfDictionary must be an indirect object.

Parameters
pdfObject the dictionary to be wrapped, must have an indirect reference.

◆ PdfFormField() [2/3]

iText.Forms.Fields.PdfFormField.PdfFormField ( PdfDocument  pdfDocument )
inlinepackage

Creates a minimal PdfFormField.

Parameters
pdfDocument The iText.Kernel.Pdf.PdfDocument instance.

◆ PdfFormField() [3/3]

iText.Forms.Fields.PdfFormField.PdfFormField ( PdfWidgetAnnotation  widget,
PdfDocument  pdfDocument 
)
inlinepackage

Creates a form field as a parent of a iText.Kernel.Pdf.Annot.PdfWidgetAnnotation.

Parameters
widget The widget which will be a kid of the PdfFormField.
pdfDocument The iText.Kernel.Pdf.PdfDocument instance.

Member Function Documentation

◆ AddKid() [1/3]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.AddKid ( AbstractPdfFormField  kid )
inlinevirtual

Adds a new kid to the Kids array property from a AbstractPdfFormField.

Adds a new kid to the Kids array property from a AbstractPdfFormField . Also sets the kid's Parent property to this object.

Parameters
kid a new AbstractPdfFormField entry for the field's Kids array property.
Returns
the edited PdfFormField.

Reimplemented in iText.Forms.Fields.PdfButtonFormField.

◆ AddKid() [2/3]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.AddKid ( AbstractPdfFormField  kid,
bool  throwExceptionOnError 
)
inlinevirtual

Adds a new kid to the Kids array property from a AbstractPdfFormField.

Adds a new kid to the Kids array property from a AbstractPdfFormField . Also sets the kid's Parent property to this object.

Parameters
kid a new AbstractPdfFormField entry for the field's Kids array property.
throwExceptionOnError define whether exception (true) or log (false) is expected in case kid with the same name exists and merge of two kids failed.
Returns
the edited PdfFormField.

◆ AddKid() [3/3]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.AddKid ( PdfWidgetAnnotation  kid )
inlinevirtual

Adds a new kid to the Kids array property from a iText.Kernel.Pdf.Annot.PdfWidgetAnnotation.

Adds a new kid to the Kids array property from a iText.Kernel.Pdf.Annot.PdfWidgetAnnotation . Also sets the kid's Parent property to this object.

Parameters
kid a new iText.Kernel.Pdf.Annot.PdfWidgetAnnotation entry for the field's Kids array property.
Returns
the edited PdfFormField.

◆ GetAdditionalAction()

virtual PdfDictionary iText.Forms.Fields.PdfFormField.GetAdditionalAction ( )
inlinevirtual

Gets the currently additional action dictionary for the form field.

Returns
the additional action dictionary.

◆ GetAllChildFields()

virtual IList<AbstractPdfFormField> iText.Forms.Fields.PdfFormField.GetAllChildFields ( )
inlinevirtual

Gets all childFields of this object, including the children of the children.

Returns
the children of the current field and their children.

◆ GetAllChildFormFields()

virtual IList<iText.Forms.Fields.PdfFormField> iText.Forms.Fields.PdfFormField.GetAllChildFormFields ( )
inlinevirtual

Gets all childFields of this object, including the children of the children but not annotations.

Returns
the children of the current field and their children.

◆ GetAlternativeName()

virtual PdfString iText.Forms.Fields.PdfFormField.GetAlternativeName ( )
inlinevirtual

Gets the current alternate name.

Gets the current alternate name. The alternate is a descriptive name to be used by status messages etc.

Returns
the current alternate name, as a iText.Kernel.Pdf.PdfString.

◆ GetAppearanceStates()

override String [] iText.Forms.Fields.PdfFormField.GetAppearanceStates ( )
inlinevirtual

Gets the appearance state names.

Returns

Gets the appearance state names.

Implements iText.Forms.Fields.AbstractPdfFormField.

◆ GetChildField()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.GetChildField ( String  fieldName )
inlinevirtual

Gets the child field of form field.

Gets the child field of form field. If there is no child field with such name, null is returned.

Parameters
fieldName a System.String , name of the received field.
Returns
the child of the current field as a PdfFormField.

◆ GetChildFields()

virtual IList<AbstractPdfFormField> iText.Forms.Fields.PdfFormField.GetChildFields ( )
inlinevirtual

Gets the childFields of this object.

Returns
the children of the current field.

◆ GetChildFormAnnotations()

virtual IList<PdfFormAnnotation> iText.Forms.Fields.PdfFormField.GetChildFormAnnotations ( )
inlinevirtual

Gets all child form field's annotations PdfFormAnnotation of this form field.

Returns
a list of PdfFormAnnotation.

◆ GetChildFormFields()

virtual IList<iText.Forms.Fields.PdfFormField> iText.Forms.Fields.PdfFormField.GetChildFormFields ( )
inlinevirtual

Gets all child form fields of this form field.

Gets all child form fields of this form field. Annotations are not returned.

Returns
a list of PdfFormField.

◆ GetDefaultAppearance()

override PdfString iText.Forms.Fields.PdfFormField.GetDefaultAppearance ( )
inlinevirtual

Gets default appearance string containing a sequence of valid page-content graphics or text state operators that define such properties as the field's text size and color.

Returns

Gets default appearance string containing a sequence of valid page-content graphics or text state operators that define such properties as the field's text size and color.

Implements iText.Forms.Fields.AbstractPdfFormField.

◆ GetDefaultStyle()

virtual PdfString iText.Forms.Fields.PdfFormField.GetDefaultStyle ( )
inlinevirtual

Gets a default style string, as described in "Rich Text Strings" section of Pdf spec.

Returns
the default style, as a iText.Kernel.Pdf.PdfString.

◆ GetDefaultValue()

virtual PdfObject iText.Forms.Fields.PdfFormField.GetDefaultValue ( )
inlinevirtual

Gets the default fallback value for the form field.

Returns
the default value.

◆ GetDisplayValue()

virtual String iText.Forms.Fields.PdfFormField.GetDisplayValue ( )
inlinevirtual

Gets the current display value of the form field.

Returns
the current display value, as a System.String , if it exists. If not, returns the value as a System.String.

◆ GetFieldFlag()

virtual bool iText.Forms.Fields.PdfFormField.GetFieldFlag ( int  flag )
inlinevirtual

Checks whether a certain flag, or any of a combination of flags, is set for this form field.

Parameters
flag an int interpreted as a series of a binary flags.
Returns
true if any of the flags specified in the parameter is also set in the form field.

◆ GetFieldFlags()

virtual int iText.Forms.Fields.PdfFormField.GetFieldFlags ( )
inlinevirtual

Gets the current list of PDF form field flags.

Returns
the current list of flags, encoded as an int.

◆ GetFirstFormAnnotation()

virtual PdfFormAnnotation iText.Forms.Fields.PdfFormField.GetFirstFormAnnotation ( )
inlinevirtual

Gets a single child form field's annotation PdfFormAnnotation.

Returns

PdfFormAnnotation or null if there are no child annotations.

◆ GetFormFieldKeys()

static ICollection<PdfName> iText.Forms.Fields.PdfFormField.GetFormFieldKeys ( )
inlinestatic

Gets a set of all possible form field keys except PdfName.Parent.

Returns
a set of form field keys.

◆ GetFormType() [1/2]

virtual PdfName iText.Forms.Fields.PdfFormField.GetFormType ( )
inlinevirtual

Returns the type of the parent form field, or of the wrapped object.

Returns
the form type, as a iText.Kernel.Pdf.PdfName.

Reimplemented in iText.Forms.Fields.PdfChoiceFormField, iText.Forms.Fields.PdfButtonFormField, iText.Forms.Fields.PdfTextFormField, and iText.Forms.Fields.PdfSignatureFormField.

◆ GetFormType() [2/2]

static PdfName iText.Forms.Fields.PdfFormField.GetFormType ( PdfDictionary  fieldDict )
inlinestatic

Returns the type of the form field dictionary, or of the parent object.

Parameters
fieldDict field dictionary to get its type.
Returns
the form type, as a iText.Kernel.Pdf.PdfName.

◆ GetJustification()

virtual ? TextAlignment iText.Forms.Fields.PdfFormField.GetJustification ( )
inlinevirtual

Gets a code specifying the form of quadding (justification) to be used in displaying the text: 0 Left-justified 1 Centered 2 Right-justified

Returns
the current justification attribute.

◆ GetKids()

virtual PdfArray iText.Forms.Fields.PdfFormField.GetKids ( )
inlinevirtual

Gets the kids of this object.

Returns
contents of the dictionary's Kids property, as a iText.Kernel.Pdf.PdfArray.

◆ GetMappingName()

virtual PdfString iText.Forms.Fields.PdfFormField.GetMappingName ( )
inlinevirtual

Gets the current mapping name.

Gets the current mapping name. The mapping name can be used when exporting the form data in the document.

Returns
the current mapping name, as a iText.Kernel.Pdf.PdfString.

◆ GetOptions()

virtual PdfArray iText.Forms.Fields.PdfFormField.GetOptions ( )
inlinevirtual

Gets options for the form field.

Gets options for the form field. Should only return usable values for checkboxes and radio buttons.

Returns
the options, as an iText.Kernel.Pdf.PdfArray of iText.Kernel.Pdf.PdfString objects.

◆ GetPartialFieldName()

virtual PdfString iText.Forms.Fields.PdfFormField.GetPartialFieldName ( )
inlinevirtual

Gets the current field partial name.

Returns
the current field partial name, as a iText.Kernel.Pdf.PdfString . If the field has no partial name, an empty iText.Kernel.Pdf.PdfString is returned.

◆ GetRichText()

virtual PdfObject iText.Forms.Fields.PdfFormField.GetRichText ( )
inlinevirtual

Gets a rich text string, as described in "Rich Text Strings" section of Pdf spec.

Gets a rich text string, as described in "Rich Text Strings" section of Pdf spec. May be either iText.Kernel.Pdf.PdfStream or iText.Kernel.Pdf.PdfString.

Returns
the current rich text value.

◆ GetValue()

virtual PdfObject iText.Forms.Fields.PdfFormField.GetValue ( )
inlinevirtual

Gets the current value contained in the form field.

Returns
the current value, as a iText.Kernel.Pdf.PdfObject.

◆ GetValueAsString()

virtual String iText.Forms.Fields.PdfFormField.GetValueAsString ( )
inlinevirtual

Gets the current value contained in the form field.

Returns
the current value, as a System.String.

◆ GetWidgets()

virtual IList<PdfWidgetAnnotation> iText.Forms.Fields.PdfFormField.GetWidgets ( )
inlinevirtual

Gets all iText.Kernel.Pdf.Annot.PdfWidgetAnnotation that its children refer to.

Returns
a list of iText.Kernel.Pdf.Annot.PdfWidgetAnnotation.

◆ IsFormField()

static bool iText.Forms.Fields.PdfFormField.IsFormField ( PdfDictionary  dict )
inlinestatic

Checks if dictionary contains any of the form field keys.

Parameters
dict field dictionary to check.
Returns
true if it is a form field dictionary, false otherwise.

◆ IsInReadingMode()

virtual bool iText.Forms.Fields.PdfFormField.IsInReadingMode ( )
inlinevirtual

Checks if the document that contains the field is created in reading mode.

Returns
true if reading mode is used, false otherwise.

◆ IsMultiline()

virtual bool iText.Forms.Fields.PdfFormField.IsMultiline ( )
inlinevirtual

If true, the field can contain multiple lines of text; if false, the field's text is restricted to a single line.

Returns
whether the field can span over multiple lines.

◆ IsNoExport()

virtual bool iText.Forms.Fields.PdfFormField.IsNoExport ( )
inlinevirtual

Gets the NoExport attribute.

Returns
whether exporting the value following a form action is forbidden.

◆ IsPassword()

virtual bool iText.Forms.Fields.PdfFormField.IsPassword ( )
inlinevirtual

If true, the field is intended for entering a secure password that should not be echoed visibly to the screen.

If true, the field is intended for entering a secure password that should not be echoed visibly to the screen. Characters typed from the keyboard should instead be echoed in some unreadable form, such as asterisks or bullet characters.

Returns
whether or not the contents of the field must be obfuscated.

◆ IsReadOnly()

virtual bool iText.Forms.Fields.PdfFormField.IsReadOnly ( )
inlinevirtual

Gets the ReadOnly flag, specifying whether or not the field can be changed.

Returns
true if the field cannot be changed.

◆ IsRequired()

virtual bool iText.Forms.Fields.PdfFormField.IsRequired ( )
inlinevirtual

Gets the Required flag, specifying whether or not the field must be filled in.

Returns
true if the field must be filled in.

◆ MakeFieldFlag()

static int iText.Forms.Fields.PdfFormField.MakeFieldFlag ( int  bitPosition )
inlinestatic

Makes a field flag by bit position.

Makes a field flag by bit position. Bit positions are numbered 1 to 32. But position 0 corresponds to flag 1, position 3 corresponds to flag 4 etc.

Parameters
bitPosition bit position of a flag in range 1 to 32 from the pdf specification.
Returns
corresponding field flag.

◆ MakeFormField()

static iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.MakeFormField ( PdfObject  pdfObject,
PdfDocument  document 
)
inlinestatic

Creates a (subtype of) PdfFormField object.

Creates a (subtype of) PdfFormField object. The type of the object depends on the FT entry in the pdfObject parameter.

Parameters
pdfObject assumed to be either a iText.Kernel.Pdf.PdfDictionary , or a iText.Kernel.Pdf.PdfIndirectReference to a iText.Kernel.Pdf.PdfDictionary.
document the iText.Kernel.Pdf.PdfDocument to create the field in.
Returns
a new PdfFormField , or null if pdfObject is not a form field.

◆ MakeFormFieldOrAnnotation()

static AbstractPdfFormField iText.Forms.Fields.PdfFormField.MakeFormFieldOrAnnotation ( PdfObject  pdfObject,
PdfDocument  document 
)
inlinestatic

Creates a (subtype of) PdfFormField or PdfFormAnnotation object depending on pdfObject.

Parameters
pdfObject assumed to be either a iText.Kernel.Pdf.PdfDictionary , or a iText.Kernel.Pdf.PdfIndirectReference to a iText.Kernel.Pdf.PdfDictionary.
document the iText.Kernel.Pdf.PdfDocument to create the field in.
Returns
a new AbstractPdfFormField , or null if pdfObject is not a form field and is not a widget annotation.

◆ RegenerateField()

override bool iText.Forms.Fields.PdfFormField.RegenerateField ( )
inlinevirtual

This method regenerates appearance stream of the field.

Returns

This method regenerates appearance stream of the field.

Implements iText.Forms.Fields.AbstractPdfFormField.

◆ Release()

override void iText.Forms.Fields.PdfFormField.Release ( )
inlinevirtual

Releases underlying pdf object and other pdf entities used by wrapper.

Reimplemented from iText.Forms.Fields.AbstractPdfFormField.

◆ RemoveChild()

virtual void iText.Forms.Fields.PdfFormField.RemoveChild ( AbstractPdfFormField  fieldName )
inlinevirtual

Removes the childField object of this field.

Parameters
fieldName a PdfFormField , that needs to be removed from form field children.

◆ RemoveChildren()

virtual void iText.Forms.Fields.PdfFormField.RemoveChildren ( )
inlinevirtual

Removes all children from the current field.

◆ SetAdditionalAction()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetAdditionalAction ( PdfName  key,
PdfAction  action 
)
inlinevirtual

Sets an additional action for the form field.

Parameters
key the dictionary key to use for storing the action.
action the action.
Returns
the edited PdfFormField.

◆ SetAlternativeName()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetAlternativeName ( String  name )
inlinevirtual

Changes the alternate name of the field to the specified value.

Changes the alternate name of the field to the specified value. The alternate is a descriptive name to be used by status messages etc.

Parameters
name the new alternate name, as a String.
Returns
the edited PdfFormField.

◆ SetCheckType()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetCheckType ( CheckBoxType  checkType )
inlinevirtual

Changes the type of graphical marker used to mark a checkbox as 'on'.

Changes the type of graphical marker used to mark a checkbox as 'on'. Notice that in order to complete the change one should call regenerateField method.

Parameters
checkType the new checkbox marker.
Returns
the edited PdfFormField.

◆ SetColor()

override AbstractPdfFormField iText.Forms.Fields.PdfFormField.SetColor ( Color  color )
inlinevirtual

Sets the text color and regenerates appearance stream.

Parameters
color

Sets the text color and regenerates appearance stream.

Returns

Sets the text color and regenerates appearance stream.

Reimplemented from iText.Forms.Fields.AbstractPdfFormField.

◆ SetDefaultStyle()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetDefaultStyle ( PdfString  defaultStyleString )
inlinevirtual

Sets a default style string, as described in "Rich Text Strings" section of Pdf spec.

Parameters
defaultStyleString a new default style for the form field.
Returns
the edited PdfFormField.

◆ SetDefaultValue()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetDefaultValue ( PdfObject  value )
inlinevirtual

Sets the default fallback value for the form field.

Parameters
value the default value.
Returns
the edited PdfFormField.

◆ SetFieldFlag() [1/2]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetFieldFlag ( int  flag )
inlinevirtual

Adds a flag, or combination of flags, for the form field.

Adds a flag, or combination of flags, for the form field. This method is intended to be used one flag at a time, but this is not technically enforced. To replace the current value, use SetFieldFlags(int).

Parameters
flag an int interpreted as a series of a binary flags.
Returns
the edited PdfFormField.

◆ SetFieldFlag() [2/2]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetFieldFlag ( int  flag,
bool  value 
)
inlinevirtual

Adds or removes a flag, or combination of flags, for the form field.

Adds or removes a flag, or combination of flags, for the form field. This method is intended to be used one flag at a time, but this is not technically enforced. To replace the current value, use SetFieldFlags(int).

Parameters
flag an int interpreted as a series of a binary flags.
value if true, adds the flag(s). if false, removes the flag(s).
Returns
the edited PdfFormField.

◆ SetFieldFlags()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetFieldFlags ( int  flags )
inlinevirtual

Sets a flag, or combination of flags, for the form field.

Sets a flag, or combination of flags, for the form field. This method replaces the previous value. Compare with SetFieldFlag(int) which adds a flag to the existing flags.

Parameters
flags an int interpreted as a series of a binary flags.
Returns
the edited PdfFormField.

◆ SetFieldName()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetFieldName ( String  name )
inlinevirtual

Changes the name of the field to the specified value.

Parameters
name the new field name, as a String.
Returns
the edited PdfFormField.

◆ SetJustification()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetJustification ( TextAlignment justification )
inlinevirtual

Sets a code specifying the form of quadding (justification) to be used in displaying the text: 0 Left-justified 1 Centered 2 Right-justified

Parameters
justification the value to set the justification attribute to.
Returns
the edited PdfFormField.

◆ SetMappingName()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetMappingName ( String  name )
inlinevirtual

Changes the mapping name of the field to the specified value.

Changes the mapping name of the field to the specified value. The mapping name can be used when exporting the form data in the document.

Parameters
name the new alternate name, as a String.
Returns
the edited field.

◆ SetNoExport()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetNoExport ( bool  noExport )
inlinevirtual

Sets the NoExport flag, specifying whether or not exporting is forbidden.

Parameters
noExport if true, then exporting is forbidden
Returns
the edited PdfFormField.

◆ SetOptions()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetOptions ( PdfArray  options )
inlinevirtual

Sets options for the form field.

Sets options for the form field. Only to be used for checkboxes and radio buttons.

Parameters
options an array of iText.Kernel.Pdf.PdfString objects that each represent the 'on' state of one of the choices.
Returns
the edited PdfFormField.

◆ SetReadOnly()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetReadOnly ( bool  readOnly )
inlinevirtual

Sets the ReadOnly flag, specifying whether or not the field can be changed.

Parameters
readOnly if true, then the field cannot be changed.
Returns
the edited PdfFormField.

◆ SetRequired()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetRequired ( bool  required )
inlinevirtual

Sets the Required flag, specifying whether or not the field must be filled in.

Parameters
required if true, then the field must be filled in.
Returns
the edited PdfFormField.

◆ SetRichText()

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetRichText ( PdfObject  richText )
inlinevirtual

Sets a rich text string, as described in "Rich Text Strings" section of Pdf spec.

Sets a rich text string, as described in "Rich Text Strings" section of Pdf spec. May be either iText.Kernel.Pdf.PdfStream or iText.Kernel.Pdf.PdfString.

Parameters
richText a new rich text value.
Returns
the edited PdfFormField.

◆ SetValue() [1/4]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetValue ( String  value )
inlinevirtual

Sets a value to the field and generating field appearance if needed.

Parameters
value of the field.
Returns
the field.

◆ SetValue() [2/4]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetValue ( String  value,
bool  generateAppearance 
)
inlinevirtual

Sets a value to the field (and fields with the same names) and generates field appearance if needed.

Parameters
value of the field.
generateAppearance if false, appearance won't be regenerated.
Returns
the field.

◆ SetValue() [3/4]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetValue ( String  value,
PdfFont  font,
float  fontSize 
)
inlinevirtual

Set text field value with given font and size.

Parameters
value text value.
font a iText.Kernel.Font.PdfFont.
fontSize the size of the font.
Returns
the edited field.

◆ SetValue() [4/4]

virtual iText.Forms.Fields.PdfFormField iText.Forms.Fields.PdfFormField.SetValue ( String  value,
String  displayValue 
)
inlinevirtual

Sets the field value and the display string.

Sets the field value and the display string. The display string is used to build the appearance.

Parameters
value the field value.
displayValue the string that is used for the appearance. If null the value parameter will be used.
Returns
the edited field.

◆ UpdateDefaultAppearance()

virtual void iText.Forms.Fields.PdfFormField.UpdateDefaultAppearance ( )
inlinevirtual

Updates DA for Variable text, Push button and choice form fields.

Updates DA for Variable text, Push button and choice form fields. The resources required for DA will be put to AcroForm's DR. Note, for other form field types DA will be removed.

Member Data Documentation

◆ FF_MULTILINE

readonly int iText.Forms.Fields.PdfFormField.FF_MULTILINE = MakeFieldFlag(13)
static

Flag that designates, if set, that the field can contain multiple lines of text.

◆ FF_NO_EXPORT

readonly int iText.Forms.Fields.PdfFormField.FF_NO_EXPORT = MakeFieldFlag(3)
static

The NoExport flag, which specifies whether or not exporting is forbidden.

◆ FF_PASSWORD

readonly int iText.Forms.Fields.PdfFormField.FF_PASSWORD = MakeFieldFlag(14)
static

Flag that designates, if set, that the field's contents must be obfuscated.

◆ FF_READ_ONLY

readonly int iText.Forms.Fields.PdfFormField.FF_READ_ONLY = MakeFieldFlag(1)
static

The ReadOnly flag, which specifies whether or not the field can be changed.

◆ FF_REQUIRED

readonly int iText.Forms.Fields.PdfFormField.FF_REQUIRED = MakeFieldFlag(2)
static

The Required flag, which specifies whether or not the field must be filled in.