Class PDFormXObject

    • Constructor Detail

      • PDFormXObject

        public PDFormXObject​(PDStream stream)
        Creates a Form XObject for reading.
        Parameters:
        stream - The XObject stream
      • PDFormXObject

        public PDFormXObject​(COSStream stream)
        Creates a Form XObject for reading.
        Parameters:
        stream - The XObject stream
      • PDFormXObject

        public PDFormXObject​(COSStream stream,
                             ResourceCache cache)
        Creates a Form XObject for reading.
        Parameters:
        stream - The XObject stream
      • PDFormXObject

        public PDFormXObject​(PDDocument document)
        Creates a Form Image XObject for writing, in the given document.
        Parameters:
        document - The current document
    • Method Detail

      • getFormType

        public int getFormType()
        This will get the form type, currently 1 is the only form type.
        Returns:
        The form type.
      • setFormType

        public void setFormType​(int formType)
        Set the form type.
        Parameters:
        formType - The new form type.
      • getContentStream

        public PDStream getContentStream()
      • getContents

        public java.io.InputStream getContents()
                                        throws java.io.IOException
        Description copied from interface: PDContentStream
        Returns this stream's content, if any.
        Specified by:
        getContents in interface PDContentStream
        Returns:
        An InputStream or null.
        Throws:
        java.io.IOException - If the stream could not be read
      • getResources

        public PDResources getResources()
        This will get the resources for this Form XObject. This will return null if no resources are available.
        Specified by:
        getResources in interface PDContentStream
        Returns:
        The resources for this Form XObject.
      • setResources

        public void setResources​(PDResources resources)
        This will set the resources for this page.
        Parameters:
        resources - The new resources for this page.
      • getBBox

        public PDRectangle getBBox()
        An array of four numbers in the form coordinate system (see below), giving the coordinates of the left, bottom, right, and top edges, respectively, of the form XObject's bounding box. These boundaries are used to clip the form XObject and to determine its size for caching.
        Specified by:
        getBBox in interface PDContentStream
        Returns:
        The BBox of the form.
      • setBBox

        public void setBBox​(PDRectangle bbox)
        This will set the BBox (bounding box) for this form.
        Parameters:
        bbox - The new BBox for this form.
      • getMatrix

        public Matrix getMatrix()
        This will get the optional matrix of an XObjectForm. It maps the form space to user space.
        Specified by:
        getMatrix in interface PDContentStream
        Returns:
        the form matrix if available, or the identity matrix.
      • setMatrix

        public void setMatrix​(java.awt.geom.AffineTransform transform)
        Sets the optional Matrix entry for the form XObject.
        Parameters:
        transform - the transformation matrix
      • getStructParents

        public int getStructParents()
        This will get the key of this XObjectForm in the structural parent tree. Required if the form XObject contains marked-content sequences that are structural content items.
        Returns:
        the integer key of the XObjectForm's entry in the structural parent tree or -1 if there isn't any.
      • setStructParents

        public void setStructParents​(int structParent)
        This will set the key for this XObjectForm in the structural parent tree.
        Parameters:
        structParent - The new key for this XObjectForm.
      • getOptionalContent

        public PDPropertyList getOptionalContent()
        This will get the optional content group or optional content membership dictionary.
        Returns:
        The optional content group or optional content membership dictionary or null if there is none.
      • setOptionalContent

        public void setOptionalContent​(PDPropertyList oc)
        Sets the optional content group or optional content membership dictionary.
        Parameters:
        oc - The optional content group or optional content membership dictionary.