Class XfdfObject


  • public class XfdfObject
    extends java.lang.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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private AnnotsObject annots
      Represent annots element, a child of the xfdf element and is the container for annot elements.
      private java.util.List<AttributeObject> attributes
      A list of attributes of xfdf object.
      private FObject f
      Represents f element, child of the xfdf element.
      private FieldsObject fields
      Represents the fields element, a child of the xfdf element and is the container for form field elements.
      private IdsObject ids
      Represents ids element, a child of the xfdf element.
    • Constructor Summary

      Constructors 
      Constructor Description
      XfdfObject()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      AnnotsObject getAnnots()
      Gets the annots element, a child of the xfdf element and is the container for annot elements.
      java.util.List<AttributeObject> getAttributes()
      Gets the list of attributes of xfdf object.
      FObject getF()
      Gets the f element, child of the xfdf element.
      FieldsObject getFields()
      Gets the fields element, a child of the xfdf element and is the container for form field elements.
      IdsObject getIds()
      Gets the ids element, child of the xfdf element.
      void mergeToPdf​(PdfDocument pdfDocument, java.lang.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​(java.util.List<AttributeObject> attributes)
      Sets the list of attributes of xfdf object.
      void setF​(FObject f)
      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 setIds​(IdsObject ids)
      Sets ids element, child of the xfdf element.
      void writeToFile​(java.io.OutputStream os)
      Writes info from XfdfObject to .xfdf file.
      void writeToFile​(java.lang.String filename)
      Writes info from XfdfObject to .xfdf file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • f

        private FObject f
        Represents f element, child of the xfdf element. Corresponds to the F key in the file dictionary.
      • ids

        private IdsObject ids
        Represents ids element, a child of the xfdf element. Corresponds to the ID key in the file dictionary.
      • fields

        private FieldsObject fields
        Represents the fields element, a child of the xfdf element and is the container for form field elements.
      • annots

        private AnnotsObject annots
        Represent annots element, a child of the xfdf element and is the container for annot elements.
      • attributes

        private java.util.List<AttributeObject> attributes
        A list of attributes of xfdf object.
    • Constructor Detail

      • XfdfObject

        public XfdfObject()
    • Method Detail

      • 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 java.util.List<AttributeObject> getAttributes()
        Gets the list of attributes of xfdf object.
        Returns:
        the list of attributes
      • setAttributes

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

        public void mergeToPdf​(PdfDocument pdfDocument,
                               java.lang.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​(java.lang.String filename)
                         throws java.io.IOException,
                                javax.xml.transform.TransformerException,
                                javax.xml.parsers.ParserConfigurationException
        Writes info from XfdfObject to .xfdf file.
        Parameters:
        filename - name of the target file.
        Throws:
        java.io.IOException - if a problem occured during opening the target file.
        javax.xml.transform.TransformerException - if there is an error while creating xml structure.
        javax.xml.parsers.ParserConfigurationException - if there is an error while writing info into xnl format.
      • writeToFile

        public void writeToFile​(java.io.OutputStream os)
                         throws javax.xml.transform.TransformerException,
                                javax.xml.parsers.ParserConfigurationException
        Writes info from XfdfObject to .xfdf file.
        Parameters:
        os - target output stream.
        Throws:
        javax.xml.transform.TransformerException - if there is an error while creating xml structure.
        javax.xml.parsers.ParserConfigurationException - if there is an error while writing info into xml format.