Class PdfAcroForm
java.lang.Object
com.itextpdf.text.pdf.PdfObject
com.itextpdf.text.pdf.PdfDictionary
com.itextpdf.text.pdf.PdfAcroForm
- All Implemented Interfaces:
Serializable
Each PDF document can contain maximum 1 AcroForm.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PdfArrayThis is an array containing the calculationorder of the fields.private PdfArrayThis is an array containing DocumentFields.private HashSet<PdfTemplate> This is a map containing FieldTemplates.private intContains the signature flags.private PdfWriter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCalculationOrder(PdfFormField formField) Adds an object to the calculationOrder.addCheckBox(String name, String value, boolean status, float llx, float lly, float urx, float ury) addComboBox(String name, String[][] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) addComboBox(String name, String[] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) voidAdds documentFields.voidAdds fieldTemplates.voidaddFormField(PdfFormField formField) Adds a formfield to the AcroForm.addHiddenField(String name, String value) addHtmlPostButton(String name, String caption, String value, String url, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) addMap(String name, String value, String url, PdfContentByte appearance, float llx, float lly, float urx, float ury) addMultiLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) addRadioButton(PdfFormField radiogroup, String value, float llx, float lly, float urx, float ury) voidaddRadioGroup(PdfFormField radiogroup) addResetButton(String name, String caption, String value, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) addSelectList(String name, String[][] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) addSelectList(String name, String[] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) addSignature(String name, float llx, float lly, float urx, float ury) addSingleLinePasswordField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) addSingleLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) voiddrawButton(PdfFormField button, String caption, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) voiddrawCheckBoxAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) voiddrawMultiLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) voiddrawRadioAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) voiddrawSignatureAppearences(PdfFormField field, float llx, float lly, float urx, float ury) voiddrawSingleLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) getRadioGroup(String name, String defaultValue, boolean noToggleToOff) booleanisValid()Checks if the Acroform is validvoidsetButtonParams(PdfFormField button, int characteristics, String name, String value) voidsetCheckBoxParams(PdfFormField field, String name, String value, boolean status, float llx, float lly, float urx, float ury) voidsetChoiceParams(PdfFormField field, String name, String defaultValue, float llx, float lly, float urx, float ury) voidsetNeedAppearances(boolean value) voidsetSigFlags(int f) Sets the signature flags.voidsetSignatureParams(PdfFormField field, String name, float llx, float lly, float urx, float ury) voidsetTextFieldParams(PdfFormField field, String text, String name, float llx, float lly, float urx, float ury) voidtoPdf(PdfWriter writer, OutputStream os) Writes the PDF representation of thisPdfDictionaryas an array ofbyteto the givenOutputStream.Methods inherited from class PdfDictionary
checkType, clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toStringMethods inherited from class PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
Field Details
-
writer
-
fieldTemplates
This is a map containing FieldTemplates. -
documentFields
This is an array containing DocumentFields. -
calculationOrder
This is an array containing the calculationorder of the fields. -
sigFlags
private int sigFlagsContains the signature flags.
-
-
Constructor Details
-
PdfAcroForm
-
-
Method Details
-
setNeedAppearances
public void setNeedAppearances(boolean value) -
addFieldTemplates
-
addDocumentField
-
isValid
public boolean isValid()Checks if the Acroform is valid- Returns:
- true if the Acroform is valid
-
addCalculationOrder
Adds an object to the calculationOrder.- Parameters:
formField-
-
setSigFlags
public void setSigFlags(int f) Sets the signature flags.- Parameters:
f-
-
addFormField
Adds a formfield to the AcroForm.- Parameters:
formField-
-
addHtmlPostButton
-
addResetButton
public PdfFormField addResetButton(String name, String caption, String value, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-caption-value-font-fontSize-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
addMap
public PdfFormField addMap(String name, String value, String url, PdfContentByte appearance, float llx, float lly, float urx, float ury) - Parameters:
name-value-url-appearance-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
setButtonParams
- Parameters:
button-characteristics-name-value-
-
drawButton
public void drawButton(PdfFormField button, String caption, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
button-caption-font-fontSize-llx-lly-urx-ury-
-
addHiddenField
- Parameters:
name-value-- Returns:
- a PdfFormField
-
addSingleLineTextField
public PdfFormField addSingleLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-text-font-fontSize-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
addMultiLineTextField
public PdfFormField addMultiLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-text-font-fontSize-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
addSingleLinePasswordField
public PdfFormField addSingleLinePasswordField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-text-font-fontSize-llx-lly-urx-ury-- Returns:
- PdfFormField
-
setTextFieldParams
public void setTextFieldParams(PdfFormField field, String text, String name, float llx, float lly, float urx, float ury) - Parameters:
field-text-name-llx-lly-urx-ury-
-
drawSingleLineOfText
public void drawSingleLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
field-text-font-fontSize-llx-lly-urx-ury-
-
drawMultiLineOfText
public void drawMultiLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
field-text-font-fontSize-llx-lly-urx-ury-
-
addCheckBox
public PdfFormField addCheckBox(String name, String value, boolean status, float llx, float lly, float urx, float ury) - Parameters:
name-value-status-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
setCheckBoxParams
public void setCheckBoxParams(PdfFormField field, String name, String value, boolean status, float llx, float lly, float urx, float ury) - Parameters:
field-name-value-status-llx-lly-urx-ury-
-
drawCheckBoxAppearences
public void drawCheckBoxAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) - Parameters:
field-value-llx-lly-urx-ury-
-
getRadioGroup
- Parameters:
name-defaultValue-noToggleToOff-- Returns:
- a PdfFormField
-
addRadioGroup
- Parameters:
radiogroup-
-
addRadioButton
public PdfFormField addRadioButton(PdfFormField radiogroup, String value, float llx, float lly, float urx, float ury) - Parameters:
radiogroup-value-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
drawRadioAppearences
public void drawRadioAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) - Parameters:
field-value-llx-lly-urx-ury-
-
addSelectList
public PdfFormField addSelectList(String name, String[] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-options-defaultValue-font-fontSize-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
addSelectList
public PdfFormField addSelectList(String name, String[][] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-options-defaultValue-font-fontSize-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
addComboBox
public PdfFormField addComboBox(String name, String[] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-options-defaultValue-editable-font-fontSize-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
addComboBox
public PdfFormField addComboBox(String name, String[][] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) - Parameters:
name-options-defaultValue-editable-font-fontSize-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
setChoiceParams
public void setChoiceParams(PdfFormField field, String name, String defaultValue, float llx, float lly, float urx, float ury) - Parameters:
field-name-defaultValue-llx-lly-urx-ury-
-
addSignature
- Parameters:
name-llx-lly-urx-ury-- Returns:
- a PdfFormField
-
setSignatureParams
public void setSignatureParams(PdfFormField field, String name, float llx, float lly, float urx, float ury) - Parameters:
field-name-llx-lly-urx-ury-
-
drawSignatureAppearences
public void drawSignatureAppearences(PdfFormField field, float llx, float lly, float urx, float ury) - Parameters:
field-llx-lly-urx-ury-
-
toPdf
Description copied from class:PdfDictionaryWrites the PDF representation of thisPdfDictionaryas an array ofbyteto the givenOutputStream.- Overrides:
toPdfin classPdfDictionary- Parameters:
writer- for backwards compatibilityos- theOutputStreamto write the bytes to.- Throws:
IOException
-