iText 8.0.5 API
iText.Forms.Fields.AbstractPdfFormField Class Referenceabstract

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

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

Public Member Functions

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...
 
abstract 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 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...
 
abstract bool  RegenerateField ()
  This method regenerates appearance stream of the field. 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...
 
abstract String[]  GetAppearanceStates ()
  Gets the appearance state names. 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 void  Release ()
  Releases underlying pdf object and other pdf entities used by wrapper. More...
 
virtual PdfDocument  GetDocument ()
  Gets the iText.Kernel.Pdf.PdfDocument that owns that form field. More...
 
virtual iText.Forms.Fields.AbstractPdfFormField  SetColor (Color color)
  Sets the text color and regenerates appearance stream. 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 Attributes

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...
 

Protected Member Functions

override bool  IsWrappedObjectMustBeIndirect ()
  Defines if the object behind this wrapper must be an indirect object in the resultant document. More...
 

Package Functions

  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

PdfFont  font
 
float  fontSize = -1
 
Color  color
 
PdfAConformanceLevel  pdfAConformanceLevel
 
IConformanceLevel  pdfConformanceLevel
 
PdfFormField  parent
  Parent form field. More...
 

Additional Inherited Members

- 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

◆ AbstractPdfFormField()

iText.Forms.Fields.AbstractPdfFormField.AbstractPdfFormField ( PdfDictionary  pdfObject )
inlinepackage

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.

Member Function Documentation

◆ DisableCurrentFieldRegeneration()

virtual void iText.Forms.Fields.AbstractPdfFormField.DisableCurrentFieldRegeneration ( )
inlinevirtual

This method disables regeneration of the current field appearance stream.

◆ DisableFieldRegeneration()

virtual void iText.Forms.Fields.AbstractPdfFormField.DisableFieldRegeneration ( )
inlinevirtual

This method disables regeneration of the field and its children appearance stream.

This method disables regeneration of the field and its children appearance stream. So all of its children in the hierarchy will also not be regenerated.

Note that after this method is called field will be regenerated only during EnableFieldRegeneration() call.

◆ EnableCurrentFieldRegeneration()

virtual void iText.Forms.Fields.AbstractPdfFormField.EnableCurrentFieldRegeneration ( )
inlinevirtual

This method enables regeneration of the current field appearance stream and regenerates it.

◆ EnableFieldRegeneration()

virtual void iText.Forms.Fields.AbstractPdfFormField.EnableFieldRegeneration ( )
inlinevirtual

This method enables regeneration of the field appearance stream.

This method enables regeneration of the field appearance stream. Please note that this method enables regeneration for the children of the field. Also, appearance will be regenerated during this method call.

Should be called after DisableFieldRegeneration() method call.

◆ Equals()

override bool iText.Forms.Fields.AbstractPdfFormField.Equals ( Object  o )
inline

Indicate whether some other object is "equal to" this one.

Indicate whether some other object is "equal to" this one. Compares wrapped objects.

◆ GetAppearanceStates()

abstract String [] iText.Forms.Fields.AbstractPdfFormField.GetAppearanceStates ( )
pure virtual

Gets the appearance state names.

Returns
an array of Strings containing the names of the appearance states.

Implemented in iText.Forms.Fields.PdfFormField, and iText.Forms.Fields.PdfFormAnnotation.

◆ GetColor()

virtual Color iText.Forms.Fields.AbstractPdfFormField.GetColor ( )
inlinevirtual

Gets the current color of the form field.

Returns
the current color

◆ GetDefaultAppearance()

abstract PdfString iText.Forms.Fields.AbstractPdfFormField.GetDefaultAppearance ( )
pure virtual

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
the default appearance graphics, as a iText.Kernel.Pdf.PdfString.

Implemented in iText.Forms.Fields.PdfFormField, and iText.Forms.Fields.PdfFormAnnotation.

◆ GetDocument()

virtual PdfDocument iText.Forms.Fields.AbstractPdfFormField.GetDocument ( )
inlinevirtual

Gets the iText.Kernel.Pdf.PdfDocument that owns that form field.

Returns
the iText.Kernel.Pdf.PdfDocument that owns that form field.

◆ GetFieldName()

virtual PdfString iText.Forms.Fields.AbstractPdfFormField.GetFieldName ( )
inlinevirtual

Gets the current field name.

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

◆ GetFont()

virtual PdfFont iText.Forms.Fields.AbstractPdfFormField.GetFont ( )
inlinevirtual

Gets the current font of the form field.

Returns
the current font

◆ GetFontSize()

virtual float iText.Forms.Fields.AbstractPdfFormField.GetFontSize ( )
inlinevirtual

Gets the current fontSize of the form field.

Returns
the current fontSize.

◆ GetHashCode()

override int iText.Forms.Fields.AbstractPdfFormField.GetHashCode ( )
inline

Generate a hash code for this object.

◆ GetParent()

virtual PdfDictionary iText.Forms.Fields.AbstractPdfFormField.GetParent ( )
inlinevirtual

Gets the parent dictionary.

Returns
another form field that this field belongs to.

◆ GetParentField()

virtual PdfFormField iText.Forms.Fields.AbstractPdfFormField.GetParentField ( )
inlinevirtual

Gets the parent field.

Returns
another form field that this field belongs to.

◆ GetPdfAConformanceLevel()

virtual PdfAConformanceLevel iText.Forms.Fields.AbstractPdfFormField.GetPdfAConformanceLevel ( )
inlinevirtual

Gets the declared conformance level.

Gets the declared conformance level. Deprecated use AbstractPdfFormField getPdfConformanceLevel

Returns
the iText.Kernel.Pdf.PdfAConformanceLevel

◆ GetPdfConformanceLevel()

virtual IConformanceLevel iText.Forms.Fields.AbstractPdfFormField.GetPdfConformanceLevel ( )
inlinevirtual

Gets the declared conformance level.

Returns
the iText.Kernel.Pdf.IConformanceLevel

◆ GetPdfObject()

override PdfDictionary iText.Forms.Fields.AbstractPdfFormField.GetPdfObject ( )
inlinevirtual

Gets the wrapped dictionary.

Returns
the wrapped dictionary.

Reimplemented from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >.

◆ IsFieldRegenerationEnabled()

virtual bool iText.Forms.Fields.AbstractPdfFormField.IsFieldRegenerationEnabled ( )
inlinevirtual

This method checks if field appearance stream regeneration is enabled.

Returns
true if regeneration is enabled for this field (and all of its ancestors), false otherwise.

◆ IsTerminalFormField()

virtual bool iText.Forms.Fields.AbstractPdfFormField.IsTerminalFormField ( )
inlinevirtual

Determines whether current form field is terminal or not.

Returns
true if this form field is a terminal one, false otherwise.

◆ IsWrappedObjectMustBeIndirect()

override bool iText.Forms.Fields.AbstractPdfFormField.IsWrappedObjectMustBeIndirect ( )
inlineprotectedvirtual

Defines if the object behind this wrapper must be an indirect object in the resultant document.

Returns

Defines if the object behind this wrapper must be an indirect object in the resultant document.

Implements iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >.

◆ Put()

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.Put ( PdfName  key,
PdfObject  value 
)
inlinevirtual

Inserts the value into the iText.Kernel.Pdf.PdfDictionary of this field and associates it with the specified key.

Inserts the value into the iText.Kernel.Pdf.PdfDictionary of this field and associates it with the specified key. If the key is already present in this field dictionary, this method will override the old value with the specified one.

Parameters
key key to insert or to override.
value the value to associate with the specified key.
Returns
the edited field.

◆ RegenerateField()

abstract bool iText.Forms.Fields.AbstractPdfFormField.RegenerateField ( )
pure virtual

This method regenerates appearance stream of the field.

This method regenerates appearance stream of the field. Use it if you changed any field parameters and didn't use setValue method which generates appearance by itself.

Returns
whether or not the regeneration was successful.

Implemented in iText.Forms.Fields.PdfFormField, and iText.Forms.Fields.PdfFormAnnotation.

◆ Release()

virtual void iText.Forms.Fields.AbstractPdfFormField.Release ( )
inlinevirtual

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

Releases underlying pdf object and other pdf entities used by wrapper. This method should be called instead of direct call to iText.Kernel.Pdf.PdfObject.Release() if the wrapper is used.

Reimplemented in iText.Forms.Fields.PdfFormField.

◆ Remove()

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.Remove ( PdfName  key )
inlinevirtual

Removes the specified key from the iText.Kernel.Pdf.PdfDictionary of this field.

Parameters
key key to be removed.
Returns
the edited field.

◆ SetColor()

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.SetColor ( Color  color )
inlinevirtual

Sets the text color and regenerates appearance stream.

Parameters
color the new value for the Color.
Returns
the edited AbstractPdfFormField.

Reimplemented in iText.Forms.Fields.PdfFormField.

◆ SetFont()

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.SetFont ( PdfFont  font )
inlinevirtual

Basic setter for the font property.

Basic setter for the font property. Regenerates the field appearance after setting the new value. Note that the font will be added to the document so ensure that the font is embedded if it's a pdf/a document.

Parameters
font The new font to be set.
Returns
The edited AbstractPdfFormField.

◆ SetFontAndSize()

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.SetFontAndSize ( PdfFont  font,
float  fontSize 
)
inlinevirtual

Combined setter for the font and fontSize properties.

Combined setter for the font and fontSize properties. Regenerates the field appearance after setting the new value.

Parameters
font The new font to be set.
fontSize The new font size to be set.
Returns
The edited AbstractPdfFormField.

◆ SetFontSize() [1/2]

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.SetFontSize ( float  fontSize )
inlinevirtual

Basic setter for the fontSize property.

Basic setter for the fontSize property. Regenerates the field appearance after setting the new value.

Parameters
fontSize The new font size to be set.
Returns
The edited AbstractPdfFormField.

◆ SetFontSize() [2/2]

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.SetFontSize ( int  fontSize )
inlinevirtual

Basic setter for the fontSize property.

Basic setter for the fontSize property. Regenerates the field appearance after setting the new value.

Parameters
fontSize The new font size to be set.
Returns
The edited AbstractPdfFormField.

◆ SetFontSizeAutoScale()

virtual iText.Forms.Fields.AbstractPdfFormField iText.Forms.Fields.AbstractPdfFormField.SetFontSizeAutoScale ( )
inlinevirtual

Sets zero font size which will be interpreted as auto-size according to ISO 32000-1, 12.7.3.3.

Returns
the edited AbstractPdfFormField.

◆ SetParent()

virtual void iText.Forms.Fields.AbstractPdfFormField.SetParent ( PdfFormField  parent )
inlinevirtual

Sets a parent PdfFormField for the current object.

Parameters
parent another form field that this field belongs to, usually a group field.

Member Data Documentation

◆ DEFAULT_FONT_SIZE

const int iText.Forms.Fields.AbstractPdfFormField.DEFAULT_FONT_SIZE = 12
static

Size of text in form fields when font size is not explicitly set.

◆ MIN_FONT_SIZE

const int iText.Forms.Fields.AbstractPdfFormField.MIN_FONT_SIZE = 4
static

Minimal size of text in form fields.

◆ parent

PdfFormField iText.Forms.Fields.AbstractPdfFormField.parent
package

Parent form field.