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
Each PDF document can contain maximum 1 AcroForm.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PdfArray
This is an array containing the calculationorder of the fields.private PdfArray
This is an array containing DocumentFields.private Map
<PdfTemplate, Object> This is a map containing FieldTemplates.private int
Contains the signature flags.private PdfWriter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCalculationOrder
(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) void
Adds documentFields.void
Adds fieldTemplates.void
addFormField
(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) void
addRadioGroup
(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) void
drawButton
(PdfFormField button, String caption, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) void
drawCheckBoxAppearences
(PdfFormField field, String value, float llx, float lly, float urx, float ury) void
drawMultiLineOfText
(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) void
drawRadioAppearences
(PdfFormField field, String value, float llx, float lly, float urx, float ury) void
drawSignatureAppearences
(PdfFormField field, float llx, float lly, float urx, float ury) void
drawSingleLineOfText
(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) getRadioGroup
(String name, String defaultValue, boolean noToggleToOff) boolean
isValid()
Checks if the Acroform is validvoid
setButtonParams
(PdfFormField button, int characteristics, String name, String value) void
setCheckBoxParams
(PdfFormField field, String name, String value, boolean status, float llx, float lly, float urx, float ury) void
setChoiceParams
(PdfFormField field, String name, String defaultValue, float llx, float lly, float urx, float ury) void
setNeedAppearances
(boolean value) void
setSigFlags
(int f) Sets the signature flags.void
setSignatureParams
(PdfFormField field, String name, float llx, float lly, float urx, float ury) void
setTextFieldParams
(PdfFormField field, String text, String name, float llx, float lly, float urx, float ury) Methods inherited from class com.lowagie.text.pdf.PdfDictionary
clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, getKeysAndValues, 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
-
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
Creates new PdfAcroForm- Parameters:
writer
-PdfWriter
-
-
Method Details
-
setNeedAppearances
public void setNeedAppearances(boolean value) -
addFieldTemplates
Adds fieldTemplates.- Parameters:
ft
- field templates
-
addDocumentField
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
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
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 fieldcaption
- captionvalue
- value of the fieldurl
- url for the actionfont
- an object ofBaseFont
fontSize
- 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 fieldcaption
- captionvalue
- value of the fieldfont
- an object ofBaseFont
fontSize
- 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 ofPdfContentByte
llx
- lower-left-xlly
- lower-left-yurx
- upper-right-xury
- upper-right-y- Returns:
- a PdfFormField
-
setButtonParams
- Parameters:
button
- an object ofPdfFormField
characteristics
- 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 ofPdfFormField
caption
- captionfont
- an object ofBaseFont
fontSize
- font sizellx
- lower-left-xlly
- lower-left-yurx
- upper-right-xury
- upper-right-y
-
addHiddenField
- 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 ofBaseFont
fontSize
- 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 ofBaseFont
fontSize
- 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 ofBaseFont
fontSize
- 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 ofPdfFormField
text
- 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 ofBaseFont
fontSize
- 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 ofPdfFormField
text
- text for fieldfont
- an object ofBaseFont
fontSize
- 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 namevalue
- value of the fieldstatus
- statusllx
- 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:
field
- field, an object ofPdfFormField
name
- field namevalue
- value of the fieldstatus
- statusllx
- 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 ofPdfFormField
value
- value of the fieldllx
- lower-left-xlly
- lower-left-yurx
- upper-right-xury
- upper-right-y
-
getRadioGroup
- Parameters:
name
- name of the fielddefaultValue
- default valuenoToggleToOff
- noToggleToOff- Returns:
- a PdfFormField
-
addRadioGroup
- 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 ofPdfFormField
value
- 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 ofBaseFont
fontSize
- 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 ofBaseFont
fontSize
- 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,true
orfalse
font
- an object ofBaseFont
fontSize
- 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,true
orfalse
font
- an object ofBaseFont
fontSize
- 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 ofPdfFormField
name
- field namedefaultValue
- default caluellx
- lower-left-xlly
- lower-left-yurx
- upper-right-xury
- upper-right-y
-
addSignature
- 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:
field
- field, an object ofPdfFormField
name
- field namellx
- 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 ofPdfFormField
llx
- lower-left-xlly
- lower-left-yurx
- upper-right-xury
- upper-right-y
-