Modifier and Type | Field and Description |
---|---|
private String[] |
choiceExports
Holds value of property choiceExports.
|
private String[] |
choices
Holds value of property choices.
|
private ArrayList<Integer> |
choiceSelections
Holds value of property choiceSelection.
|
private String |
defaultText
Holds value of property defaultText.
|
private BaseFont |
extensionFont
Holds value of property extensionFont.
|
private float |
extraMarginLeft |
private float |
extraMarginTop |
private ArrayList<BaseFont> |
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, MULTISELECT, options, PASSWORD, READ_ONLY, REQUIRED, rotation, text, textColor, visibility, VISIBLE, VISIBLE_BUT_DOES_NOT_PRINT, writer
Constructor and Description |
---|
TextField(PdfWriter writer,
Rectangle box,
String fieldName)
Creates a new
TextField . |
Modifier and Type | Method and Description |
---|---|
void |
addChoiceSelection(int selection)
adds another (or a first I suppose) selection to a MULTISELECT list.
|
private static void |
changeFontSize(Phrase p,
float size) |
private static boolean |
checkRTL(String text) |
private Phrase |
composePhrase(String text,
BaseFont ufont,
BaseColor color,
float fontSize) |
PdfAppearance |
getAppearance()
Get the
PdfAppearance of a text or combo field |
String[] |
getChoiceExports()
Gets the export values in list/combo fields.
|
protected PdfFormField |
getChoiceField(boolean isList) |
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.
|
ArrayList<Integer> |
getChoiceSelections()
Gets the selected items.
|
PdfFormField |
getComboField()
Gets a new combo field.
|
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.
|
ArrayList<BaseFont> |
getSubstitutionFonts()
Gets the list of substitution fonts.
|
PdfFormField |
getTextField()
Gets a new text field.
|
private int |
getTopChoice() |
(package private) int |
getTopFirst() |
static String |
obfuscatePassword(String text)
Obfuscates a password
String . |
static String |
removeCRLF(String text)
Removes CRLF from a
String . |
void |
setChoiceExports(String[] choiceExports)
Sets the export values in list/combo fields.
|
void |
setChoices(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 |
setChoiceSelections(ArrayList<Integer> selections)
replaces the existing selections with the param.
|
void |
setDefaultText(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(ArrayList<BaseFont> substitutionFonts)
Sets a list of substitution fonts.
|
private void |
writeMultipleValues(PdfFormField field,
String[][] mix) |
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 String defaultText
private String[] choiceExports
private ArrayList<Integer> choiceSelections
private int topFirst
private float extraMarginLeft
private float extraMarginTop
private ArrayList<BaseFont> substitutionFonts
private BaseFont extensionFont
public TextField(PdfWriter writer, Rectangle box, 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 void changeFontSize(Phrase p, float size)
private Phrase composePhrase(String text, BaseFont ufont, BaseColor color, float fontSize)
public static String removeCRLF(String text)
String
.text
- public static String obfuscatePassword(String text)
String
.
Every character is replaced by an asterisk (*).text
- public PdfAppearance getAppearance() throws IOException, DocumentException
PdfAppearance
of a text or combo fieldPdfAppearance
IOException
- on errorDocumentException
- on errorPdfAppearance getListAppearance() throws IOException, DocumentException
PdfAppearance
of a list fieldPdfAppearance
IOException
- on errorDocumentException
- on errorpublic PdfFormField getTextField() throws IOException, DocumentException
IOException
- on errorDocumentException
- on errorpublic PdfFormField getComboField() throws IOException, DocumentException
IOException
- on errorDocumentException
- on errorpublic PdfFormField getListField() throws IOException, DocumentException
IOException
- on errorDocumentException
- on errorprivate int getTopChoice()
protected PdfFormField getChoiceField(boolean isList) throws IOException, DocumentException
IOException
DocumentException
private void writeMultipleValues(PdfFormField field, String[][] mix)
public String getDefaultText()
public void setDefaultText(String defaultText)
defaultText
- the default textpublic String[] getChoices()
public void setChoices(String[] choices)
choices
- the choices to be presented to the userpublic String[] getChoiceExports()
public void setChoiceExports(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 ArrayList<Integer> getChoiceSelections()
public void setChoiceSelection(int choiceSelection)
choiceSelection
- the zero based index of the selected itempublic void addChoiceSelection(int selection)
selection
- new selectionpublic void setChoiceSelections(ArrayList<Integer> selections)
selections
- new selections. If null, it clear()s the underlying ArrayList.int getTopFirst()
public void setExtraMargin(float extraMarginLeft, float extraMarginTop)
extraMarginLeft
- the extra margin leftextraMarginTop
- the extra margin toppublic ArrayList<BaseFont> 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(ArrayList<BaseFont> 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.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses