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

This class represents a single annotation in form fields hierarchy in an AcroForm. More...

Inheritance diagram for iText.Forms.Fields.PdfFormAnnotation:
iText.Forms.Fields.AbstractPdfFormField iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >

Public Member Functions

virtual PdfWidgetAnnotation  GetWidget ()
  Gets iText.Kernel.Pdf.Annot.PdfWidgetAnnotation that this form field refers to. 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...
 
override bool  RegenerateField ()
  This method regenerates appearance stream of the field. More...
 
override String[]  GetAppearanceStates ()
  Gets the appearance state names. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetBackgroundColor (Color backgroundColor)
  Basic setter for the backgroundColor property. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetCaption (String caption)
  Basic setter for the push button caption. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetCaption (String caption, bool regenerateField)
  Basic setter for the push button caption. More...
 
virtual int  GetRotation ()
  Get rotation property specified in this form annotation. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetRotation (int degRotation)
  Basic setter for the degRotation property. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetAction (PdfAction action)
  Sets the action on widget of this annotation form field. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetVisibility (int visibility)
  Set the visibility flags of the form field annotation. More...
 
virtual float  GetBorderWidth ()
  Gets the border width for the field. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetBorderWidth (float borderWidth)
  Sets the border width for the field. More...
 
virtual Border  GetBorder ()
  Get border object specified in the widget annotation dictionary. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetBorderStyle (PdfDictionary style)
  Sets the border style for the field. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetBorderColor (Color color)
  Sets the Border Color. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetPage (int pageNum)
  Specifies on which page the form field's widget must be shown. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetFormFieldElement (IFormField element)
  This method sets the model element associated with the current annotation and can be useful to take into account when drawing those properties that the annotation does not have. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetAppearance (PdfName appearanceType, String appearanceState, PdfStream appearanceStream)
  Sets an appearance for (the widgets related to) the form field. More...
 
virtual iText.Forms.Fields.PdfFormAnnotation  SetCheckBoxAppearanceOnStateName (String onStateName)
  Sets on state name for the checkbox annotation normal appearance and regenerates widget. 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 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 Member Functions

static iText.Forms.Fields.PdfFormAnnotation  MakeFormAnnotation (PdfObject pdfObject, PdfDocument document)
  Creates a PdfFormAnnotation object. More...
 

Static Public Attributes

const int  HIDDEN = 1
 
const int  VISIBLE_BUT_DOES_NOT_PRINT = 2
 
const int  HIDDEN_BUT_PRINTABLE = 3
 
const int  VISIBLE = 4
 
const String  OFF_STATE_VALUE = "Off"
  Value which represents "off" state of form field. More...
 
const String  ON_STATE_VALUE = "Yes"
  Value which represents "on" state of form field. 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

  PdfFormAnnotation (PdfWidgetAnnotation widget, PdfDocument pdfDocument)
  Creates a form field annotation as a wrapper of a iText.Kernel.Pdf.Annot.PdfWidgetAnnotation. More...
 
  PdfFormAnnotation (PdfDictionary pdfObject)
  Creates a form field annotation as a wrapper object around a iText.Kernel.Pdf.PdfDictionary. More...
 
virtual Rectangle  GetRect (PdfDictionary field)
  Gets a iText.Kernel.Geom.Rectangle that matches the current size and position of this form field. More...
 
virtual void  DrawBorder (PdfCanvas canvas, PdfFormXObject xObject, float width, float height)
  Draws a border using the borderWidth and borderColor of the form field. More...
 
virtual void  DrawPushButtonFieldAndSaveAppearance ()
  Draws the appearance of a push button and saves it into an appearance stream. More...
 
virtual void  DrawSignatureFormFieldAndSaveAppearance ()
  Draws the appearance of a signature field and saves it into an appearance stream. More...
 
virtual void  DrawRadioButtonAndSaveAppearance (String value)
  Draws the appearance of a radio button with a specified value and saves it into an appearance stream. More...
 
virtual void  DrawListFormFieldAndSaveAppearance ()
  Draws the appearance of a list box form field and saves it into an appearance stream. More...
 
virtual void  DrawTextFormFieldAndSaveAppearance ()
  Draws the appearance of a text form field and saves it into an appearance stream. More...
 
virtual void  DrawComboBoxAndSaveAppearance ()
  Draws the appearance of a Combo box form field and saves it into an appearance stream. More...
 
virtual void  DrawCheckBoxAndSaveAppearance (String onStateName)
  Draw a checkbox and save its appearance. 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

float  borderWidth = 1
 
Color  backgroundColor
 
Color  borderColor
 
- 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 annotation in form fields hierarchy in an AcroForm.

This class represents a single annotation in form fields hierarchy 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

◆ PdfFormAnnotation() [1/2]

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

Creates a form field annotation as a wrapper 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.

◆ PdfFormAnnotation() [2/2]

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

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

Creates a form field annotation 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

◆ DrawBorder()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawBorder ( PdfCanvas  canvas,
PdfFormXObject  xObject,
float  width,
float  height 
)
inlinepackagevirtual

Draws a border using the borderWidth and borderColor of the form field.

Parameters
canvas The iText.Kernel.Pdf.Canvas.PdfCanvas on which to draw
xObject The PdfFormXObject
width The width of the rectangle to draw
height The height of the rectangle to draw

◆ DrawCheckBoxAndSaveAppearance()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawCheckBoxAndSaveAppearance ( String  onStateName )
inlinepackagevirtual

Draw a checkbox and save its appearance.

Parameters
onStateName the name of the appearance state for the checked state

◆ DrawComboBoxAndSaveAppearance()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawComboBoxAndSaveAppearance ( )
inlinepackagevirtual

Draws the appearance of a Combo box form field and saves it into an appearance stream.

◆ DrawListFormFieldAndSaveAppearance()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawListFormFieldAndSaveAppearance ( )
inlinepackagevirtual

Draws the appearance of a list box form field and saves it into an appearance stream.

◆ DrawPushButtonFieldAndSaveAppearance()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawPushButtonFieldAndSaveAppearance ( )
inlinepackagevirtual

Draws the appearance of a push button and saves it into an appearance stream.

◆ DrawRadioButtonAndSaveAppearance()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawRadioButtonAndSaveAppearance ( String  value )
inlinepackagevirtual

Draws the appearance of a radio button with a specified value and saves it into an appearance stream.

Parameters
value the value of the radio button.

◆ DrawSignatureFormFieldAndSaveAppearance()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawSignatureFormFieldAndSaveAppearance ( )
inlinepackagevirtual

Draws the appearance of a signature field and saves it into an appearance stream.

◆ DrawTextFormFieldAndSaveAppearance()

virtual void iText.Forms.Fields.PdfFormAnnotation.DrawTextFormFieldAndSaveAppearance ( )
inlinepackagevirtual

Draws the appearance of a text form field and saves it into an appearance stream.

◆ GetAppearanceStates()

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

Gets the appearance state names.

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

Implements iText.Forms.Fields.AbstractPdfFormField.

◆ GetBorder()

virtual Border iText.Forms.Fields.PdfFormAnnotation.GetBorder ( )
inlinevirtual

Get border object specified in the widget annotation dictionary.

Returns

iText.Layout.Borders.Border specified in the widget annotation dictionary

◆ GetBorderWidth()

virtual float iText.Forms.Fields.PdfFormAnnotation.GetBorderWidth ( )
inlinevirtual

Gets the border width for the field.

Returns
the current border width.

◆ GetDefaultAppearance()

override PdfString iText.Forms.Fields.PdfFormAnnotation.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.

◆ GetRect()

virtual Rectangle iText.Forms.Fields.PdfFormAnnotation.GetRect ( PdfDictionary  field )
inlinepackagevirtual

Gets a iText.Kernel.Geom.Rectangle that matches the current size and position of this form field.

Parameters
field current form field.
Returns
a iText.Kernel.Geom.Rectangle that matches the current size and position of this form field annotation.

◆ GetRotation()

virtual int iText.Forms.Fields.PdfFormAnnotation.GetRotation ( )
inlinevirtual

Get rotation property specified in this form annotation.

Returns

int value which represents field's rotation

◆ GetWidget()

virtual PdfWidgetAnnotation iText.Forms.Fields.PdfFormAnnotation.GetWidget ( )
inlinevirtual

◆ MakeFormAnnotation()

static iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.MakeFormAnnotation ( PdfObject  pdfObject,
PdfDocument  document 
)
inlinestatic

Creates a PdfFormAnnotation object.

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 PdfFormAnnotation , or null if pdfObject is not a widget annotation.

◆ RegenerateField()

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

This method regenerates appearance stream of the field.

Returns

This method regenerates appearance stream of the field.

Implements iText.Forms.Fields.AbstractPdfFormField.

◆ SetAction()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetAction ( PdfAction  action )
inlinevirtual

Sets the action on widget of this annotation form field.

Parameters
action The action.
Returns
The edited PdfFormAnnotation.

◆ SetAppearance()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetAppearance ( PdfName  appearanceType,
String  appearanceState,
PdfStream  appearanceStream 
)
inlinevirtual

Sets an appearance for (the widgets related to) the form field.

Parameters
appearanceType the type of appearance stream to be added
  • PdfName.N: normal appearance
  • PdfName.R: rollover appearance
  • PdfName.D: down appearance
appearanceState the state of the form field that needs to be true for the appearance to be used. Differentiates between several streams of the same type.
appearanceStream the appearance instructions, as a iText.Kernel.Pdf.PdfStream.
Returns
The edited PdfFormAnnotation.

◆ SetBackgroundColor()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetBackgroundColor ( Color  backgroundColor )
inlinevirtual

Basic setter for the backgroundColor property.

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

Parameters
backgroundColor The new color to be set or null if no background needed.
Returns
The edited PdfFormAnnotation.

◆ SetBorderColor()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetBorderColor ( Color  color )
inlinevirtual

Sets the Border Color.

Parameters
color the new value for the Border Color.
Returns
The edited PdfFormAnnotation.

◆ SetBorderStyle()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetBorderStyle ( PdfDictionary  style )
inlinevirtual

Sets the border style for the field.

Parameters
style the new border style.
Returns
The edited PdfFormAnnotation.

◆ SetBorderWidth()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetBorderWidth ( float  borderWidth )
inlinevirtual

Sets the border width for the field.

Parameters
borderWidth The new border width.
Returns
The edited PdfFormAnnotation.

◆ SetCaption() [1/2]

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetCaption ( String  caption )
inlinevirtual

Basic setter for the push button caption.

Basic setter for the push button caption. Regenerates the field appearance after setting the new caption.

Parameters
caption button caption to be set.
Returns
The edited PdfFormAnnotation.

◆ SetCaption() [2/2]

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetCaption ( String  caption,
bool  regenerateField 
)
inlinevirtual

Basic setter for the push button caption.

Basic setter for the push button caption. Regenerates the field appearance after setting the new caption if corresponding parameter is specified.

Parameters
caption button caption to be set.
regenerateField true if field should be regenerated, false otherwise.
Returns
The edited PdfFormAnnotation.

◆ SetCheckBoxAppearanceOnStateName()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetCheckBoxAppearanceOnStateName ( String  onStateName )
inlinevirtual

Sets on state name for the checkbox annotation normal appearance and regenerates widget.

Parameters
onStateName the new appearance name representing on state.
Returns
The edited PdfFormAnnotation.

◆ SetFormFieldElement()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetFormFieldElement ( IFormField  element )
inlinevirtual

This method sets the model element associated with the current annotation and can be useful to take into account when drawing those properties that the annotation does not have.

This method sets the model element associated with the current annotation and can be useful to take into account when drawing those properties that the annotation does not have. Note that annotation properties will take precedence, so such properties cannot be overridden by using this method (e.g. background, text color, etc.).

Also note that the model element won't be used for annotations for choice form field.

Parameters
element model element to set.
Returns
this PdfFormAnnotation.

◆ SetPage()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetPage ( int  pageNum )
inlinevirtual

Specifies on which page the form field's widget must be shown.

Parameters
pageNum the page number.
Returns
The edited PdfFormAnnotation.

◆ SetRotation()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetRotation ( int  degRotation )
inlinevirtual

Basic setter for the degRotation property.

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

Parameters
degRotation The new degRotation to be set
Returns
The edited PdfFormAnnotation.

◆ SetVisibility()

virtual iText.Forms.Fields.PdfFormAnnotation iText.Forms.Fields.PdfFormAnnotation.SetVisibility ( int  visibility )
inlinevirtual

Set the visibility flags of the form field annotation.

Set the visibility flags of the form field annotation. Options are: HIDDEN, HIDDEN_BUT_PRINTABLE, VISIBLE, VISIBLE_BUT_DOES_NOT_PRINT.

Parameters
visibility visibility option.
Returns
The edited PdfFormAnnotation.

Member Data Documentation

◆ OFF_STATE_VALUE

const String iText.Forms.Fields.PdfFormAnnotation.OFF_STATE_VALUE = "Off"
static

Value which represents "off" state of form field.

◆ ON_STATE_VALUE

const String iText.Forms.Fields.PdfFormAnnotation.ON_STATE_VALUE = "Yes"
static

Value which represents "on" state of form field.