public class TextField extends BaseField
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
choiceExports
Holds value of property choiceExports.
|
private java.lang.String[] |
choices
Holds value of property choices.
|
private int |
choiceSelection
Holds value of property choiceSelection.
|
private java.lang.String |
defaultText
Holds value of property defaultText.
|
private BaseFont |
extensionFont
Holds value of property extensionFont.
|
private float |
extraMarginLeft |
private float |
extraMarginTop |
private java.util.ArrayList |
substitutionFonts
Holds value of property substitutionFonts.
|
private int |
topFirst |
alignment, backgroundColor, BORDER_WIDTH_MEDIUM, BORDER_WIDTH_THICK, BORDER_WIDTH_THIN, borderColor, borderStyle, borderWidth, box, COMB, DO_NOT_SCROLL, DO_NOT_SPELL_CHECK, EDIT, fieldName, FILE_SELECTION, font, fontSize, HIDDEN, HIDDEN_BUT_PRINTABLE, maxCharacterLength, MULTILINE, options, PASSWORD, READ_ONLY, REQUIRED, rotation, text, textColor, visibility, VISIBLE, VISIBLE_BUT_DOES_NOT_PRINT, writer
Constructor and Description |
---|
TextField(PdfWriter writer,
Rectangle box,
java.lang.String fieldName)
Creates a new
TextField . |
Modifier and Type | Method and Description |
---|---|
private static void |
changeFontSize(Phrase p,
float size) |
private static boolean |
checkRTL(java.lang.String text) |
private Phrase |
composePhrase(java.lang.String text,
BaseFont ufont,
java.awt.Color color,
float fontSize) |
PdfAppearance |
getAppearance()
Get the
PdfAppearance of a text or combo field |
java.lang.String[] |
getChoiceExports()
Gets the export values in list/combo fields.
|
protected PdfFormField |
getChoiceField(boolean isList) |
java.lang.String[] |
getChoices()
Gets the choices to be presented to the user in list/combo fields.
|
int |
getChoiceSelection()
Gets the zero based index of the selected item.
|
PdfFormField |
getComboField()
Gets a new combo field.
|
java.lang.String |
getDefaultText()
Gets the default text.
|
BaseFont |
getExtensionFont()
Gets the extensionFont.
|
(package private) PdfAppearance |
getListAppearance()
Get the
PdfAppearance of a list field |
PdfFormField |
getListField()
Gets a new list field.
|
java.util.ArrayList |
getSubstitutionFonts()
Gets the list of substitution fonts.
|
PdfFormField |
getTextField()
Gets a new text field.
|
(package private) int |
getTopFirst() |
static java.lang.String |
obfuscatePassword(java.lang.String text)
Obfuscates a password
String . |
static java.lang.String |
removeCRLF(java.lang.String text)
Removes CRLF from a
String . |
void |
setChoiceExports(java.lang.String[] choiceExports)
Sets the export values in list/combo fields.
|
void |
setChoices(java.lang.String[] choices)
Sets the choices to be presented to the user in list/combo fields.
|
void |
setChoiceSelection(int choiceSelection)
Sets the zero based index of the selected item.
|
void |
setDefaultText(java.lang.String defaultText)
Sets the default text.
|
void |
setExtensionFont(BaseFont extensionFont)
Sets the extensionFont.
|
void |
setExtraMargin(float extraMarginLeft,
float extraMarginTop)
Sets extra margins in text fields to better mimic the Acrobat layout.
|
void |
setSubstitutionFonts(java.util.ArrayList substitutionFonts)
Sets a list of substitution fonts.
|
breakLines, getAlignment, getBackgroundColor, getBorderAppearance, getBorderColor, getBorderStyle, getBorderWidth, getBox, getFieldName, getFont, getFontSize, getHardBreaks, getMaxCharacterLength, getOptions, getRealFont, getRotation, getText, getTextColor, getVisibility, getWriter, moveFields, setAlignment, setBackgroundColor, setBorderColor, setBorderStyle, setBorderWidth, setBox, setFieldName, setFont, setFontSize, setMaxCharacterLength, setOptions, setRotation, setRotationFromPage, setText, setTextColor, setVisibility, setWriter, trimRight
private java.lang.String defaultText
private java.lang.String[] choices
private java.lang.String[] choiceExports
private int choiceSelection
private int topFirst
private float extraMarginLeft
private float extraMarginTop
private java.util.ArrayList substitutionFonts
private BaseFont extensionFont
public TextField(PdfWriter writer, Rectangle box, java.lang.String fieldName)
TextField
.writer
- the document PdfWriter
box
- the field location and dimensionsfieldName
- the field name. If null
only the widget keys
will be included in the field allowing it to be used as a kid field.private static boolean checkRTL(java.lang.String text)
private static void changeFontSize(Phrase p, float size)
private Phrase composePhrase(java.lang.String text, BaseFont ufont, java.awt.Color color, float fontSize)
public static java.lang.String removeCRLF(java.lang.String text)
String
.text
- public static java.lang.String obfuscatePassword(java.lang.String text)
String
.
Every character is replaced by an asterisk (*).text
- public PdfAppearance getAppearance() throws java.io.IOException, DocumentException
PdfAppearance
of a text or combo fieldPdfAppearance
java.io.IOException
- on errorDocumentException
- on errorPdfAppearance getListAppearance() throws java.io.IOException, DocumentException
PdfAppearance
of a list fieldPdfAppearance
java.io.IOException
- on errorDocumentException
- on errorpublic PdfFormField getTextField() throws java.io.IOException, DocumentException
java.io.IOException
- on errorDocumentException
- on errorpublic PdfFormField getComboField() throws java.io.IOException, DocumentException
java.io.IOException
- on errorDocumentException
- on errorpublic PdfFormField getListField() throws java.io.IOException, DocumentException
java.io.IOException
- on errorDocumentException
- on errorprotected PdfFormField getChoiceField(boolean isList) throws java.io.IOException, DocumentException
java.io.IOException
DocumentException
public java.lang.String getDefaultText()
public void setDefaultText(java.lang.String defaultText)
defaultText
- the default textpublic java.lang.String[] getChoices()
public void setChoices(java.lang.String[] choices)
choices
- the choices to be presented to the userpublic java.lang.String[] getChoiceExports()
public void setChoiceExports(java.lang.String[] choiceExports)
null
then the choice values will also be used
as the export values.choiceExports
- the export values in list/combo fieldspublic int getChoiceSelection()
public void setChoiceSelection(int choiceSelection)
choiceSelection
- the zero based index of the selected itemint getTopFirst()
public void setExtraMargin(float extraMarginLeft, float extraMarginTop)
extraMarginLeft
- the extra margin leftextraMarginTop
- the extra margin toppublic java.util.ArrayList getSubstitutionFonts()
BaseFont
and can be null
. The fonts in this list will be used if the original
font doesn't contain the needed glyphs.public void setSubstitutionFonts(java.util.ArrayList substitutionFonts)
BaseFont
and can also be null
. The fonts in this list will be used if the original
font doesn't contain the needed glyphs.substitutionFonts
- the listpublic BaseFont getExtensionFont()
null
.public void setExtensionFont(BaseFont extensionFont)
null
.extensionFont
- New value of property extensionFont.