public class CreateVisibleSignature extends CreateSignatureBase
CreateSignature| Constructor and Description | 
|---|
CreateVisibleSignature(KeyStore keystore,
                      char[] pin)
Initialize the signature creator with a keystore (pkcs12) and pin that
 should be used for the signature. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
isLateExternalSigning()  | 
static void | 
main(String[] args)
Arguments are
 [0] key store
 [1] pin
 [2] document that will be signed
 [3] image of visible signature 
 | 
void | 
setLateExternalSigning(boolean lateExternalSigning)
Set late external signing. 
 | 
void | 
setVisibleSignatureProperties(String name,
                             String location,
                             String reason,
                             boolean visualSignEnabled)
Set visible signature properties for existing signature fields. 
 | 
void | 
setVisibleSignatureProperties(String name,
                             String location,
                             String reason,
                             int preferredSize,
                             int page,
                             boolean visualSignEnabled)
Set visible signature properties for new signature fields. 
 | 
void | 
setVisibleSignDesigner(int zoomPercent,
                      InputStream imageStream)
Set visible signature designer for an existing signature field. 
 | 
void | 
setVisibleSignDesigner(String filename,
                      int x,
                      int y,
                      int zoomPercent,
                      InputStream imageStream,
                      int page)
Set visible signature designer for a new signature field. 
 | 
void | 
signPDF(File inputFile,
       File signedFile,
       String tsaUrl)
Sign pdf file and create new file that ends with "_signed.pdf". 
 | 
void | 
signPDF(File inputFile,
       File signedFile,
       String tsaUrl,
       String signatureFieldName)
Sign pdf file and create new file that ends with "_signed.pdf". 
 | 
isExternalSigning, setCertificateChain, setExternalSigning, setPrivateKey, setTsaUrl, signpublic CreateVisibleSignature(KeyStore keystore, char[] pin) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, IOException, CertificateException
keystore - is a pkcs12 keystore.pin - is the pin for the keystore / private keyKeyStoreException - if the keystore has not been initialized (loaded)NoSuchAlgorithmException - if the algorithm for recovering the key cannot be foundUnrecoverableKeyException - if the given password is wrongCertificateException - if the certificate is not valid as signing timeIOException - if no certificate could be foundpublic boolean isLateExternalSigning()
public void setLateExternalSigning(boolean lateExternalSigning)
lateExternalSigning - public void setVisibleSignDesigner(String filename, int x, int y, int zoomPercent, InputStream imageStream, int page) throws IOException
filename - x - position of the signature fieldy - position of the signature fieldzoomPercent - increase (positive value) or decrease (negative value) image with x percent.imageStream - input stream of an image.page - the signature should be placed onIOExceptionpublic void setVisibleSignDesigner(int zoomPercent,
                                   InputStream imageStream)
                            throws IOException
zoomPercent - increase (positive value) or decrease (negative value) image with x percent.imageStream - input stream of an image.IOExceptionpublic void setVisibleSignatureProperties(String name, String location, String reason, int preferredSize, int page, boolean visualSignEnabled)
name - location - reason - preferredSize - page - visualSignEnabled - public void setVisibleSignatureProperties(String name, String location, String reason, boolean visualSignEnabled)
name - location - reason - visualSignEnabled - public void signPDF(File inputFile, File signedFile, String tsaUrl) throws IOException
inputFile - The source pdf document file.signedFile - The file to be signed.tsaUrl - optional TSA urlIOExceptionpublic void signPDF(File inputFile, File signedFile, String tsaUrl, String signatureFieldName) throws IOException
inputFile - The source pdf document file.signedFile - The file to be signed.tsaUrl - optional TSA urlsignatureFieldName - optional name of an existing (unsigned) signature fieldIOExceptionpublic static void main(String[] args) throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException
args - KeyStoreExceptionCertificateExceptionIOExceptionNoSuchAlgorithmExceptionUnrecoverableKeyExceptionCopyright © 2002–2018 The Apache Software Foundation. All rights reserved.