Interface PDFTemplateBuilder

  • All Known Implementing Classes:
    PDVisibleSigBuilder

    public interface PDFTemplateBuilder
    That class builds visible signature template which will be added in our PDF document.
    • Method Detail

      • createAffineTransform

        void createAffineTransform​(java.awt.geom.AffineTransform affineTransform)
        In order to create Affine Transform, using parameters.
        Parameters:
        affineTransform - the affine transformation to be used
      • createPage

        void createPage​(PDVisibleSignDesigner properties)
        Creates specified size page.
        Parameters:
        properties - page properties
      • createTemplate

        void createTemplate​(PDPage page)
                     throws java.io.IOException
        Creates template using page.
        Parameters:
        page - page to be added
        Throws:
        java.io.IOException - if the template could not be created
      • createAcroForm

        void createAcroForm​(PDDocument template)
        Creates Acro forms in the template.
        Parameters:
        template - the document the acroform is added to
      • createSignatureField

        void createSignatureField​(PDAcroForm acroForm)
                           throws java.io.IOException
        Creates signature fields.
        Parameters:
        acroForm - the acroform the signature is added to
        Throws:
        java.io.IOException - if the signature could not be created
      • createSignature

        void createSignature​(PDSignatureField pdSignatureField,
                             PDPage page,
                             java.lang.String signerName)
                      throws java.io.IOException
        Creates the signature with the given name and assign it to the signature field parameter and assign the page parameter to the widget.
        Parameters:
        pdSignatureField - the signature filed the signatur is added to
        page - the page the widgt ist added to
        signerName - the name of the person or authority signing the document. According to the PDF specification, this value should be used only when it is not possible to extract the name from the signature.
        Throws:
        java.io.IOException - if the signature could not be created
      • createAcroFormDictionary

        void createAcroFormDictionary​(PDAcroForm acroForm,
                                      PDSignatureField signatureField)
                               throws java.io.IOException
        Create AcroForm Dictionary.
        Parameters:
        acroForm - the acroform the signature field is added to
        signatureField - the signature filed to be added
        Throws:
        java.io.IOException - if the signature field could not be added
      • createSignatureRectangle

        void createSignatureRectangle​(PDSignatureField signatureField,
                                      PDVisibleSignDesigner properties)
                               throws java.io.IOException
        Creates SignatureRectangle.
        Parameters:
        signatureField - the signature field the rectangle is added to
        properties - the properties used to create the rectangle
        Throws:
        java.io.IOException - if the rectangle could not be created
      • createProcSetArray

        void createProcSetArray()
        Creates procSetArray of PDF,Text,ImageB,ImageC,ImageI.
      • createSignatureImage

        void createSignatureImage​(PDDocument template,
                                  java.awt.image.BufferedImage image)
                           throws java.io.IOException
        Creates signature image.
        Parameters:
        template - the document the image is added to
        image - to imager to be added
        Throws:
        java.io.IOException - if the image could not be added
      • createFormatterRectangle

        void createFormatterRectangle​(int[] params)
        An array of four numbers in the form coordinate system, giving the coordinates of the left, bottom, right, and top edges, respectively, of the form XObject’s bounding box. These boundaries shall be used to clip the form XObject and to determine its size for caching.
        Parameters:
        params - the parameters of the formatter rectangle
      • createHolderFormStream

        void createHolderFormStream​(PDDocument template)
        Create a holder for the form stream.
        Parameters:
        template - the document to be used to create the new stream
      • createHolderFormResources

        void createHolderFormResources()
        Creates resources of form
      • createHolderForm

        void createHolderForm​(PDResources holderFormResources,
                              PDStream holderFormStream,
                              PDRectangle bbox)
        Creates Form
        Parameters:
        holderFormResources - resources to be used for the form object
        holderFormStream - the stream to be used for the form object
        bbox - the bounding box of the form object
      • createAppearanceDictionary

        void createAppearanceDictionary​(PDFormXObject holderForm,
                                        PDSignatureField signatureField)
                                 throws java.io.IOException
        Creates appearance dictionary
        Parameters:
        holderForm - form object to be used for the appearance stream
        signatureField - the signature field the appearance stream is added to
        Throws:
        java.io.IOException - if the appearance stream could not be created
      • createInnerFormStream

        void createInnerFormStream​(PDDocument template)
        Create a holder for the inner form stream.
        Parameters:
        template - the document to be used to create the new stream
      • createInnerFormResource

        void createInnerFormResource()
        Creates InnerForm
      • createInnerForm

        void createInnerForm​(PDResources innerFormResources,
                             PDStream innerFormStream,
                             PDRectangle bbox)
        Creates InnerForm.
        Parameters:
        innerFormResources - resources to be used for the inner form object
        innerFormStream - the stream to be used for the inner form object
        bbox - the bounding box of the inner form object
      • insertInnerFormToHolderResources

        void insertInnerFormToHolderResources​(PDFormXObject innerForm,
                                              PDResources holderFormResources)
        Insert given from as inner form.
        Parameters:
        innerForm - the form object to be inserted
        holderFormResources - resources the form object is added to
      • createImageFormStream

        void createImageFormStream​(PDDocument template)
        Create image form stream.
        Parameters:
        template - the document to be used to create the new stream
      • createImageFormResources

        void createImageFormResources()
        Create resource of image form
      • createImageForm

        void createImageForm​(PDResources imageFormResources,
                             PDResources innerFormResource,
                             PDStream imageFormStream,
                             PDRectangle bbox,
                             java.awt.geom.AffineTransform affineTransform,
                             PDImageXObject img)
                      throws java.io.IOException
        Creates Image form
        Parameters:
        imageFormResources - the resources of the form object
        innerFormResource - the resources the image object is added
        imageFormStream - the stream of the form object
        bbox - the bounding box of the form object
        affineTransform - the matrix of the form object
        img - the image object to be used for the form object
        Throws:
        java.io.IOException - if the form object could not be created
      • createBackgroundLayerForm

        void createBackgroundLayerForm​(PDResources innerFormResource,
                                       PDRectangle bbox)
                                throws java.io.IOException
        Creates the background layer form (n0).
        Parameters:
        innerFormResource - resources to be used for the form object
        bbox - the bounding box of the form object
        Throws:
        java.io.IOException - if the form object could not be created
      • injectProcSetArray

        void injectProcSetArray​(PDFormXObject innerForm,
                                PDPage page,
                                PDResources innerFormResources,
                                PDResources imageFormResources,
                                PDResources holderFormResources,
                                COSArray procSet)
        Inject procSetArray
        Parameters:
        innerForm - form object the given proc set array is added to
        page - page the given proc set array is added to
        innerFormResources - inner form resources the given proc set array is added to
        imageFormResources - inner image resources the given proc set array is added to
        holderFormResources - holder form resources the given proc set array is added to
        procSet - the pro set array to be added
      • injectAppearanceStreams

        void injectAppearanceStreams​(PDStream holderFormStream,
                                     PDStream innerFormStream,
                                     PDStream imageFormStream,
                                     COSName imageFormName,
                                     COSName imageName,
                                     COSName innerFormName,
                                     PDVisibleSignDesigner properties)
                              throws java.io.IOException
        injects appearance streams
        Parameters:
        holderFormStream - the holder form stream
        innerFormStream - the inner form stream
        imageFormStream - the image form stream
        imageFormName - the name of the form image to be used
        imageName - the name of the image to be used
        innerFormName - the name of the form object to be used
        properties - properties to be used to create the appearance stream
        Throws:
        java.io.IOException - if the appearance stream could not be created
      • createVisualSignature

        void createVisualSignature​(PDDocument template)
        just to create visible signature
        Parameters:
        template - the document holding the visible signature
      • createWidgetDictionary

        void createWidgetDictionary​(PDSignatureField signatureField,
                                    PDResources holderFormResources)
                             throws java.io.IOException
        adds Widget Dictionary
        Parameters:
        signatureField - the field to be used as widget dictionary
        holderFormResources - the resources to be added to the widget dictionary
        Throws:
        java.io.IOException - if the widget dictionary could not be created
      • getStructure

        PDFTemplateStructure getStructure()
        Returns the PDF template Structure
        Returns:
        PDF template Structure
      • closeTemplate

        void closeTemplate​(PDDocument template)
                    throws java.io.IOException
        Closes template
        Parameters:
        template - the document to be closed
        Throws:
        java.io.IOException - if the document could not be closed