Class PDVisibleSigBuilder

  • All Implemented Interfaces:
    PDFTemplateBuilder

    public class PDVisibleSigBuilder
    extends java.lang.Object
    implements PDFTemplateBuilder
    Implementation of PDFTemplateBuilder. This builds the signature PDF but doesn't keep the elements, these are kept in its PDF template structure.
    • Field Detail

      • LOG

        private static final org.apache.commons.logging.Log LOG
    • Constructor Detail

      • PDVisibleSigBuilder

        public PDVisibleSigBuilder()
        Constructor, creates PDF template structure.
    • Method Detail

      • createTemplate

        public void createTemplate​(PDPage page)
                            throws java.io.IOException
        Creates a PDDocument and adds the page parameter to it and keeps this as a template in the PDF template Structure.
        Specified by:
        createTemplate in interface PDFTemplateBuilder
        Parameters:
        page -
        Throws:
        java.io.IOException
      • createSignatureField

        public void createSignatureField​(PDAcroForm acroForm)
                                  throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        Creates signature fields.
        Specified by:
        createSignatureField in interface PDFTemplateBuilder
        Parameters:
        acroForm - the acroform
        Throws:
        java.io.IOException - if something went wrong
      • createSignature

        public void createSignature​(PDSignatureField pdSignatureField,
                                    PDPage page,
                                    java.lang.String signerName)
                             throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        Creates the signature with the given name and assign it to the signature field parameter and assign the page parameter to the widget.
        Specified by:
        createSignature in interface PDFTemplateBuilder
        Parameters:
        pdSignatureField - signature filed
        page - the given page
        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 something went wrong
      • createAcroFormDictionary

        public void createAcroFormDictionary​(PDAcroForm acroForm,
                                             PDSignatureField signatureField)
                                      throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        Create AcroForm Dictionary.
        Specified by:
        createAcroFormDictionary in interface PDFTemplateBuilder
        Parameters:
        acroForm - the acroform
        signatureField - the signature field
        Throws:
        java.io.IOException - if something went wrong
      • createAffineTransform

        public void createAffineTransform​(java.awt.geom.AffineTransform affineTransform)
        Description copied from interface: PDFTemplateBuilder
        In order to create Affine Transform, using parameters.
        Specified by:
        createAffineTransform in interface PDFTemplateBuilder
        Parameters:
        affineTransform - the transformation
      • createSignatureImage

        public void createSignatureImage​(PDDocument template,
                                         java.awt.image.BufferedImage image)
                                  throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        Creates signature image.
        Specified by:
        createSignatureImage in interface PDFTemplateBuilder
        Parameters:
        template - template document
        image - signature image
        Throws:
        java.io.IOException - if something went wrong
      • createFormatterRectangle

        @Deprecated
        public void createFormatterRectangle​(byte[] 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.
        Specified by:
        createFormatterRectangle in interface PDFTemplateBuilder
        Parameters:
        params - parameters
      • createFormatterRectangle

        public void createFormatterRectangle​(int[] params)
        Description copied from interface: PDFTemplateBuilder
        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.
        Specified by:
        createFormatterRectangle in interface PDFTemplateBuilder
        Parameters:
        params - parameters
      • createImageForm

        public void createImageForm​(PDResources imageFormResources,
                                    PDResources innerFormResource,
                                    PDStream imageFormStream,
                                    PDRectangle bbox,
                                    java.awt.geom.AffineTransform at,
                                    PDImageXObject img)
                             throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        Creates Image form
        Specified by:
        createImageForm in interface PDFTemplateBuilder
        Parameters:
        imageFormResources - image form resources
        innerFormResource - inner form resources
        imageFormStream - image from stream
        bbox - bounding box
        at - transformation
        img - ImageXObject
        Throws:
        java.io.IOException - if something went wrong
      • createBackgroundLayerForm

        public void createBackgroundLayerForm​(PDResources innerFormResource,
                                              PDRectangle bbox)
                                       throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        Creates the background layer form (n0).
        Specified by:
        createBackgroundLayerForm in interface PDFTemplateBuilder
        Parameters:
        innerFormResource - inner acroform resources
        bbox - rectangle of the formatter
        Throws:
        java.io.IOException - if something went wrong
      • injectAppearanceStreams

        public void injectAppearanceStreams​(PDStream holderFormStream,
                                            PDStream innerFormStream,
                                            PDStream imageFormStream,
                                            COSName imageFormName,
                                            COSName imageName,
                                            COSName innerFormName,
                                            PDVisibleSignDesigner properties)
                                     throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        injects appearance streams
        Specified by:
        injectAppearanceStreams in interface PDFTemplateBuilder
        Parameters:
        holderFormStream - holder form stream
        innerFormStream - inner form stream
        imageFormStream - image form stream
        imageFormName - image form name
        imageName - image name
        innerFormName - inner form name
        properties - property values
        Throws:
        java.io.IOException - if something went wrong
      • appendRawCommands

        public void appendRawCommands​(java.io.OutputStream os,
                                      java.lang.String commands)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • createWidgetDictionary

        public void createWidgetDictionary​(PDSignatureField signatureField,
                                           PDResources holderFormResources)
                                    throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        adds Widget Dictionary
        Specified by:
        createWidgetDictionary in interface PDFTemplateBuilder
        Parameters:
        signatureField - the signature field
        holderFormResources - holder form resources
        Throws:
        java.io.IOException - if something went wrong
      • closeTemplate

        public void closeTemplate​(PDDocument template)
                           throws java.io.IOException
        Description copied from interface: PDFTemplateBuilder
        Closes template
        Specified by:
        closeTemplate in interface PDFTemplateBuilder
        Parameters:
        template - template document
        Throws:
        java.io.IOException - if something went wrong