Class CreateVisibleSignature

  • All Implemented Interfaces:
    org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface

    public class CreateVisibleSignature
    extends CreateSignatureBase
    Visually signs a PDF with pdf box. A keystore can be created with the java keytool.
    Since:
    7.7.2
    Author:
    Marco Meschieri - LogicalDOC
    • Method Detail

      • isLateExternalSigning

        public boolean isLateExternalSigning()
      • setLateExternalSigning

        public void setLateExternalSigning​(boolean lateExternalSigning)
        Set late external signing. Enable this if you want to activate the demo code where the signature is kept and added in an extra step without using PDFBox methods. This is disabled by default.
        Parameters:
        lateExternalSigning - external signing flag
      • setVisibleSignDesigner

        public void setVisibleSignDesigner​(String filename,
                                           int x,
                                           int y,
                                           int zoomPercent,
                                           FileInputStream imageStream,
                                           int page)
                                    throws IOException
        Set visible signature designer for a new signature field.
        Parameters:
        filename - name of the file
        x - position of the signature field
        y - position of the signature field
        zoomPercent - zoom as percent 0..1
        imageStream - content of the image
        page - the signature should be placed on
        Throws:
        IOException - cannot write the PDF file
      • setVisibleSignDesigner

        public void setVisibleSignDesigner​(String filename,
                                           int x,
                                           int y,
                                           Integer width,
                                           Integer height,
                                           FileInputStream imageStream,
                                           int page)
                                    throws IOException
        Set visible signature designer for a new signature field.
        Parameters:
        filename - name of the file
        x - position of the signature field
        y - position of the signature field
        width - width of the image
        height - height of the image
        imageStream - content of the image
        page - the signature should be placed on
        Throws:
        IOException - cannot write the PDF file
      • setVisibleSignatureProperties

        public void setVisibleSignatureProperties​(String name,
                                                  String location,
                                                  String reason,
                                                  int preferredSize,
                                                  int page,
                                                  boolean visualSignEnabled)
                                           throws IOException
        Set visible signature properties for new signature fields.
        Parameters:
        name - name of the signer
        location - the location
        reason - the reason for signing
        preferredSize - preferred width
        page - index of the page to place the signature
        visualSignEnabled - flag indicating if the signature must be visible
        Throws:
        IOException - cannot write the PDF file
      • signPDF

        public void signPDF​(File inputFile,
                            File signedFile)
                     throws IOException
        Sign pdf file and create new file
        Parameters:
        inputFile - The source pdf document file
        signedFile - The file to be signed
        Throws:
        IOException - cannot write the PDF file