Class XfdfObject

java.lang.Object
com.itextpdf.forms.xfdf.XfdfObject

public class XfdfObject extends Object
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 Details

    • XfdfObject

      public XfdfObject()
  • Method Details

    • getF

      public FObject getF()
      Gets the f element, child of the xfdf element. Corresponds to the F key in the file dictionary.
      Returns:
      the f element
    • setF

      public void setF (FObject f)
      Sets f element, child of the xfdf element. Corresponds to the F key in the file dictionary.
      Parameters:
      f - element
    • getIds

      public IdsObject getIds()
      Gets the ids element, child of the xfdf element. Corresponds to the ID key in the file dictionary.
      Returns:
      the ids element
    • setIds

      public void setIds (IdsObject ids)
      Sets ids element, child of the xfdf element. Corresponds to the ID key in the file dictionary.
      Parameters:
      ids - element
    • getFields

      public FieldsObject getFields()
      Gets the fields element, a child of the xfdf element and is the container for form field elements.
      Returns:
      the fields element
    • setFields

      public void setFields (FieldsObject fields)
      Sets fields element, a child of the xfdf element and is the container for form field elements.
      Parameters:
      fields - element
    • getAnnots

      public AnnotsObject getAnnots()
      Gets the annots element, a child of the xfdf element and is the container for annot elements.
      Returns:
      the annots element
    • setAnnots

      public void setAnnots (AnnotsObject annots)
      Sets the annots element, a child of the xfdf element and is the container for annot elements.
      Parameters:
      annots - element
    • getAttributes

      public List<AttributeObject> getAttributes()
      Gets the list of attributes of xfdf object.
      Returns:
      the list of attributes
    • setAttributes

      public void setAttributes (List<AttributeObject> attributes)
      Sets the list of attributes of xfdf object.
      Parameters:
      attributes - list of attributes objects
    • mergeToPdf

      public void mergeToPdf (PdfDocument pdfDocument, String pdfDocumentName)
      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

      public void writeToFile (OutputStream os) throws TransformerException, ParserConfigurationException
      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.