Package com.itextpdf.forms.xfdf
Class XfdfObject
java.lang.Object
com.itextpdf.forms.xfdf.XfdfObject
Represents xfdf element, the top level element in an xfdf document. For more details see paragraph 6.2.1 in Xfdf document specification. Content model: ( f? & ids? & fields? & annots? ) Attributes: xml:space, xmlns.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the annots element, a child of the xfdf element and is the container for annot elements.Gets the list of attributes of xfdf object.getF()
Gets the f element, child of the xfdf element.Gets the fields element, a child of the xfdf element and is the container for form field elements.getIds()
Gets the ids element, child of the xfdf element.void
mergeToPdf
(PdfDocument pdfDocument, String pdfDocumentName) Merges info from XfdfObject to pdf document.void
setAnnots
(AnnotsObject annots) Sets the annots element, a child of the xfdf element and is the container for annot elements.void
setAttributes
(List<AttributeObject> attributes) Sets the list of attributes of xfdf object.void
Sets f element, child of the xfdf element.void
setFields
(FieldsObject fields) Sets fields element, a child of the xfdf element and is the container for form field elements.void
Sets ids element, child of the xfdf element.void
Writes info from XfdfObject to .xfdf file.void
writeToFile
(String filename) Writes info from XfdfObject to .xfdf file.
-
Constructor Details
-
XfdfObject
public XfdfObject()
-
-
Method Details
-
getF
Gets the f element, child of the xfdf element. Corresponds to the F key in the file dictionary.- Returns:
- the f element
-
setF
Sets f element, child of the xfdf element. Corresponds to the F key in the file dictionary.- Parameters:
-
f
- element
-
getIds
Gets the ids element, child of the xfdf element. Corresponds to the ID key in the file dictionary.- Returns:
- the ids element
-
setIds
Sets ids element, child of the xfdf element. Corresponds to the ID key in the file dictionary.- Parameters:
-
ids
- element
-
getFields
Gets the fields element, a child of the xfdf element and is the container for form field elements.- Returns:
- the fields element
-
setFields
Sets fields element, a child of the xfdf element and is the container for form field elements.- Parameters:
-
fields
- element
-
getAnnots
Gets the annots element, a child of the xfdf element and is the container for annot elements.- Returns:
- the annots element
-
setAnnots
Sets the annots element, a child of the xfdf element and is the container for annot elements.- Parameters:
-
annots
- element
-
getAttributes
Gets the list of attributes of xfdf object.- Returns:
- the list of attributes
-
setAttributes
Sets the list of attributes of xfdf object.- Parameters:
-
attributes
- list of attributes objects
-
mergeToPdf
Merges info from XfdfObject to pdf document.- Parameters:
-
pdfDocument
- the target document for merge. -
pdfDocumentName
- the name of the target document. Will be checked in the merge process to determined if it is the same as href attribute of f element of merged XfdfObject. If the names are different, a warning will be thrown.
-
writeToFile
public void writeToFile(String filename) throws IOException, TransformerException, ParserConfigurationException Writes info from XfdfObject to .xfdf file.- Parameters:
-
filename
- name of the target file. - Throws:
-
IOException
- if a problem occured during opening the target file. -
TransformerException
- if there is an error while creating xml structure. -
ParserConfigurationException
- if there is an error while writing info into xnl format.
-
writeToFile
Writes info from XfdfObject to .xfdf file.- Parameters:
-
os
- target output stream. - Throws:
-
TransformerException
- if there is an error while creating xml structure. -
ParserConfigurationException
- if there is an error while writing info into xml format.
-