Package com.itextpdf.forms.fields
Class PdfTextFormField
java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
com.itextpdf.forms.fields.PdfFormField
com.itextpdf.forms.fields.PdfTextFormField
An AcroForm field containing textual data.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
Fields inherited from class com.itextpdf.forms.fields.PdfFormField
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, backgroundColor, borderColor, borderWidth, checkType, color, FF_MULTILINE, FF_NO_EXPORT, FF_PASSWORD, FF_READ_ONLY, FF_REQUIRED, font, fontSize, form, HIDDEN, HIDDEN_BUT_PRINTABLE, img, pdfAConformanceLevel, rotation, text, TYPE_CHECK, TYPE_CIRCLE, TYPE_CROSS, TYPE_DIAMOND, TYPE_SQUARE, TYPE_STAR, VISIBLE, VISIBLE_BUT_DOES_NOT_PRINT
-
Constructor Summary
ModifierConstructorDescriptionprotected
PdfTextFormField
(PdfWidgetAnnotation widget, PdfDocument pdfDocument) protected
PdfTextFormField
(PdfDictionary pdfObject) protected
PdfTextFormField
(PdfDocument pdfDocument) -
Method Summary
Modifier and TypeMethodDescriptionReturnsTx
, the form type for textual form fields.int
Gets the maximum length of the field's text, in characters.boolean
isComb()
Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear.boolean
If true, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.boolean
If true, the value of this field should be represented as a rich text string.boolean
isScroll()
If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle.boolean
If true, text entered in the field is spell-checked.setComb
(boolean comb) Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear.setFileSelect
(boolean fileSelect) If true, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.setMaxLen
(int maxLen) Sets the maximum length of the field's text, in characters.setMultiline
(boolean multiline) If true, the field can contain multiple lines of text; if false, the field?s text is restricted to a single line.setPassword
(boolean password) If true, the field is intended for entering a secure password that should not be echoed visibly to the screen.setRichText
(boolean richText) If true, the value of this field should be represented as a rich text string.setScroll
(boolean scroll) If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle.setSpellCheck
(boolean spellCheck) If true, text entered in the field is spell-checked.Methods inherited from class com.itextpdf.forms.fields.PdfFormField
addKid, addKid, createButton, createButton, createButton, createButton, createCheckBox, createCheckBox, createCheckBox, createChoice, createChoice, createChoice, createChoice, createChoice, createChoice, createChoice, createComboBox, createComboBox, createComboBox, createComboBox, createEmptyField, createEmptyField, createList, createList, createList, createList, createMultilineText, createMultilineText, createPushButton, createPushButton, createPushButton, createRadioButton, createRadioButton, createRadioGroup, createRadioGroup, createSignature, createSignature, createSignature, createSignature, createText, createText, createText, createText, createText, createText, createText, createText, drawBorder, drawButton, drawCheckAppearance, drawCheckBox, drawMultiLineTextAppearance, drawPdfA2CheckAppearance, drawPdfACheckBox, drawPushButtonAppearance, drawRadioAppearance, drawRadioBorder, drawRadioField, drawTextAppearance, getAdditionalAction, getAlternativeName, getAppearanceStates, getBorderWidth, getColor, getDefaultAppearance, getDefaultStyle, getDefaultValue, getDocument, getFieldFlag, getFieldFlags, getFieldName, getFont, getFontSize, getJustification, getKids, getMappingName, getOptions, getParent, getRect, getRichText, getValue, getValueAsString, getWidgets, isMultiline, isNoExport, isPassword, isReadOnly, isRequired, isWrappedObjectMustBeIndirect, makeFieldFlag, makeFormField, processOptions, processOptions, put, regenerateField, release, remove, setAction, setAdditionalAction, setAlternativeName, setAppearance, setBackgroundColor, setBorderColor, setBorderStyle, setBorderWidth, setCheckType, setColor, setDefaultStyle, setDefaultValue, setFieldFlag, setFieldFlag, setFieldFlags, setFieldName, setFont, setFontAndSize, setFontSize, setFontSize, setFontSizeAutoScale, setJustification, setMappingName, setNoExport, setOptions, setPage, setParent, setReadOnly, setRequired, setRichText, setRotation, setValue, setValue, setValue, setValue, setVisibility, splitDAelements, updateDefaultAppearance
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, flush, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Field Details
-
FF_FILE_SELECT
public static final int FF_FILE_SELECT -
FF_DO_NOT_SPELL_CHECK
public static final int FF_DO_NOT_SPELL_CHECK -
FF_DO_NOT_SCROLL
public static final int FF_DO_NOT_SCROLL -
FF_COMB
public static final int FF_COMB -
FF_RICH_TEXT
public static final int FF_RICH_TEXT
-
-
Constructor Details
-
PdfTextFormField
-
PdfTextFormField
-
PdfTextFormField
-
-
Method Details
-
getFormType
ReturnsTx
, the form type for textual form fields.- Overrides:
-
getFormType
in classPdfFormField
- Returns:
-
the form type, as a
PdfName
-
setMultiline
If true, the field can contain multiple lines of text; if false, the field?s text is restricted to a single line.- Parameters:
-
multiline
- whether or not the file can contain multiple lines of text - Returns:
-
current
PdfTextFormField
-
setPassword
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.- Parameters:
-
password
- whether or not to obscure the typed characters - Returns:
-
current
PdfTextFormField
-
isFileSelect
public boolean isFileSelect()If true, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.- Returns:
- whether or not this field currently represents a path
-
setFileSelect
If true, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.- Parameters:
-
fileSelect
- whether or not this field should represent a path - Returns:
-
current
PdfTextFormField
-
isSpellCheck
public boolean isSpellCheck()If true, text entered in the field is spell-checked.- Returns:
- whether or not spell-checking is currently enabled
-
setSpellCheck
If true, text entered in the field is spell-checked.- Parameters:
-
spellCheck
- whether or not to spell-check - Returns:
-
current
PdfTextFormField
-
isScroll
public boolean isScroll()If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text is accepted.- Returns:
- whether or not longer texts are currently allowed
-
setScroll
If true, the field scrolls (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text is accepted.- Parameters:
-
scroll
- whether or not to allow longer texts - Returns:
-
current
PdfTextFormField
-
isComb
public boolean isComb()Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear. If true, the field is automatically divided into as many equally spaced positions, or combs, as the value of MaxLen, and the text is laid out into those combs.- Returns:
- whether or not combing is enabled
-
setComb
Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear. If true, the field is automatically divided into as many equally spaced positions, or combs, as the value of MaxLen, and the text is laid out into those combs.- Parameters:
-
comb
- whether or not to enable combing - Returns:
-
current
PdfTextFormField
-
isRichText
public boolean isRichText()If true, the value of this field should be represented as a rich text string. If the field has a value, the RV entry of the field dictionary specifies the rich text string.- Returns:
- whether or not text is currently represented as rich text
-
setRichText
If true, the value of this field should be represented as a rich text string. If the field has a value, the RV entry of the field dictionary specifies the rich text string.- Parameters:
-
richText
- whether or not to represent text as rich text - Returns:
-
current
PdfTextFormField
-
getMaxLen
public int getMaxLen()Gets the maximum length of the field's text, in characters. This is an optional parameter, so if it is not specified, 0 value will be returned.- Returns:
- the current maximum text length
-
setMaxLen
Sets the maximum length of the field's text, in characters.- Parameters:
-
maxLen
- the maximum text length - Returns:
- current
-