Package com.lowagie.text.pdf
Class PdfAcroForm
- java.lang.Object
-
- com.lowagie.text.pdf.PdfObject
-
- com.lowagie.text.pdf.PdfDictionary
-
- com.lowagie.text.pdf.PdfAcroForm
-
public class PdfAcroForm extends PdfDictionary
Each PDF document can contain maximum 1 AcroForm.
-
-
Constructor Summary
Constructors Constructor Description PdfAcroForm(PdfWriter writer)Creates new PdfAcroForm
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddCalculationOrder(PdfFormField formField)Adds an object to the calculationOrder.PdfFormFieldaddCheckBox(String name, String value, boolean status, float llx, float lly, float urx, float ury)PdfFormFieldaddComboBox(String name, String[][] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)PdfFormFieldaddComboBox(String name, String[] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)voidaddDocumentField(PdfIndirectReference ref)Adds documentFields.voidaddFieldTemplates(HashMap ft)Deprecated.voidaddFieldTemplates(Map<PdfTemplate,Object> ft)Adds fieldTemplates.voidaddFormField(PdfFormField formField)Adds a formfield to the AcroForm.PdfFormFieldaddHiddenField(String name, String value)PdfFormFieldaddHtmlPostButton(String name, String caption, String value, String url, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)PdfFormFieldaddMap(String name, String value, String url, PdfContentByte appearance, float llx, float lly, float urx, float ury)PdfFormFieldaddMultiLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)PdfFormFieldaddRadioButton(PdfFormField radiogroup, String value, float llx, float lly, float urx, float ury)voidaddRadioGroup(PdfFormField radiogroup)PdfFormFieldaddResetButton(String name, String caption, String value, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)PdfFormFieldaddSelectList(String name, String[][] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)PdfFormFieldaddSelectList(String name, String[] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)PdfFormFieldaddSignature(String name, float llx, float lly, float urx, float ury)PdfFormFieldaddSingleLinePasswordField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)PdfFormFieldaddSingleLineTextField(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)PdfFormFieldgetRadioGroup(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)-
Methods inherited from class com.lowagie.text.pdf.PdfDictionary
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toString
-
Methods inherited from class com.lowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
-
-
-
Method Detail
-
setNeedAppearances
public void setNeedAppearances(boolean value)
-
addFieldTemplates
@Deprecated public void addFieldTemplates(HashMap ft)
Deprecated.Adds fieldTemplates.- Parameters:
ft- field templates
-
addFieldTemplates
public void addFieldTemplates(Map<PdfTemplate,Object> ft)
Adds fieldTemplates.- Parameters:
ft- field templates
-
addDocumentField
public void addDocumentField(PdfIndirectReference ref)
Adds documentFields.- Parameters:
ref- an object ofPdfIndirectReference
-
isValid
public boolean isValid()
Checks if the Acroform is valid- Returns:
- true if the Acroform is valid
-
addCalculationOrder
public void addCalculationOrder(PdfFormField formField)
Adds an object to the calculationOrder.- Parameters:
formField- an object ofPdfFormField
-
setSigFlags
public void setSigFlags(int f)
Sets the signature flags.- Parameters:
f- signature flag
-
addFormField
public void addFormField(PdfFormField formField)
Adds a formfield to the AcroForm.- Parameters:
formField- an object ofPdfFormField
-
addHtmlPostButton
public PdfFormField addHtmlPostButton(String name, String caption, String value, String url, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)
- Parameters:
name- name of the fieldvalue- value of the fieldurl- url for the actioncaption- captionfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- Returns:
- a PdfFormField
-
addResetButton
public PdfFormField addResetButton(String name, String caption, String value, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)
- Parameters:
name- name of the fieldvalue- value of the fieldcaption- captionfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- 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- name of the fieldvalue- value of the fieldurl- url of the actionappearance- an object ofPdfContentBytellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- Returns:
- a PdfFormField
-
setButtonParams
public void setButtonParams(PdfFormField button, int characteristics, String name, String value)
- Parameters:
button- an object ofPdfFormFieldcharacteristics- characteristicsname- name of the fieldvalue- value of the field
-
drawButton
public void drawButton(PdfFormField button, String caption, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)
- Parameters:
button- an object ofPdfFormFieldcaption- captionfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
addHiddenField
public PdfFormField addHiddenField(String name, String value)
- Parameters:
name- name of the fieldvalue- value of the field- 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- name of the fieldtext- value for fieldfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- 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- name of the fieldtext- value for fieldfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- 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- name of the fieldtext- text for the fieldfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- Returns:
- PdfFormField
-
setTextFieldParams
public void setTextFieldParams(PdfFormField field, String text, String name, float llx, float lly, float urx, float ury)
- Parameters:
field- an object ofPdfFormFieldtext- text for the fieldname- name of the fieldllx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
drawSingleLineOfText
public void drawSingleLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)
- Parameters:
field- fieldtext- text for the fieldfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
drawMultiLineOfText
public void drawMultiLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)
- Parameters:
field- field, an object ofPdfFormFieldtext- text for fieldfont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
addCheckBox
public PdfFormField addCheckBox(String name, String value, boolean status, float llx, float lly, float urx, float ury)
- Parameters:
name- field namestatus- statusvalue- value of the fieldllx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- Returns:
- a PdfFormField
-
setCheckBoxParams
public void setCheckBoxParams(PdfFormField field, String name, String value, boolean status, float llx, float lly, float urx, float ury)
- Parameters:
name- field namestatus- statusfield- field, an object ofPdfFormFieldvalue- value of the fieldllx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
drawCheckBoxAppearences
public void drawCheckBoxAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury)
- Parameters:
field- field, an object ofPdfFormFieldvalue- value of the fieldllx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
getRadioGroup
public PdfFormField getRadioGroup(String name, String defaultValue, boolean noToggleToOff)
- Parameters:
name- name of the fielddefaultValue- default valuenoToggleToOff- noToggleToOff- Returns:
- a PdfFormField
-
addRadioGroup
public void addRadioGroup(PdfFormField radiogroup)
- Parameters:
radiogroup- field
-
addRadioButton
public PdfFormField addRadioButton(PdfFormField radiogroup, String value, float llx, float lly, float urx, float ury)
- Parameters:
radiogroup- radio group fieldvalue- value of the fieldllx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- Returns:
- a PdfFormField
-
drawRadioAppearences
public void drawRadioAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury)
- Parameters:
field- field, an object ofPdfFormFieldvalue- valuellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
addSelectList
public PdfFormField addSelectList(String name, String[] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury)
- Parameters:
name- name of the fieldoptions- optionsdefaultValue- default valuefont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- 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- name of the fieldoptions- optionsdefaultValue- default valuefont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- 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- name of the fieldoptions- optionsdefaultValue- default valueeditable- if field is editable,trueorfalsefont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- 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- name of the fieldoptions- optionsdefaultValue- default valueeditable- if field is editable,trueorfalsefont- an object ofBaseFontfontSize- font sizellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- Returns:
- a PdfFormField
-
setChoiceParams
public void setChoiceParams(PdfFormField field, String name, String defaultValue, float llx, float lly, float urx, float ury)
- Parameters:
field- field, an object ofPdfFormFieldname- field namedefaultValue- default caluellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
addSignature
public PdfFormField addSignature(String name, float llx, float lly, float urx, float ury)
- Parameters:
name- field namellx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y- Returns:
- a PdfFormField
-
setSignatureParams
public void setSignatureParams(PdfFormField field, String name, float llx, float lly, float urx, float ury)
- Parameters:
name- field namefield- field, an object ofPdfFormFieldllx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
drawSignatureAppearences
public void drawSignatureAppearences(PdfFormField field, float llx, float lly, float urx, float ury)
- Parameters:
field- field, an object ofPdfFormFieldllx- lower-left-xlly- lower-left-yurx- upper-right-xury- upper-right-y
-
-