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 |
---|---|
static void |
main(String[] args)
Arguments are
[0] key store
[1] pin
[2] document that will be signed
[3] image of visible signature
|
void |
setVisibleSignatureProperties(String name,
String location,
String reason,
int preferredSize,
int page,
boolean visualSignEnabled) |
void |
setVisibleSignDesigner(String filename,
int x,
int y,
int zoomPercent,
FileInputStream imageStream,
int page) |
void |
signPDF(File inputFile,
File signedFile,
TSAClient tsaClient)
Sign pdf file and create new file that ends with "_signed.pdf".
|
getTsaClient, isExternalSigning, setCertificate, setExternalSigning, setPrivateKey, setTsaClient, sign
public 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 void setVisibleSignDesigner(String filename, int x, int y, int zoomPercent, FileInputStream imageStream, int page) throws IOException
IOException
public void setVisibleSignatureProperties(String name, String location, String reason, int preferredSize, int page, boolean visualSignEnabled) throws IOException
IOException
public void signPDF(File inputFile, File signedFile, TSAClient tsaClient) throws IOException
inputFile
- The source pdf document file.signedFile
- The file to be signed.tsaClient
- optional TSA clientIOException
public static void main(String[] args) throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException
args
- KeyStoreException
CertificateException
IOException
NoSuchAlgorithmException
UnrecoverableKeyException
Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.