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,
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".
|
void |
signPDF(File inputFile,
File signedFile,
TSAClient tsaClient,
String signatureFieldName)
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 boolean isLateExternalSigning()
public void setLateExternalSigning(boolean lateExternalSigning)
lateExternalSigning
- public 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 void signPDF(File inputFile, File signedFile, TSAClient tsaClient, String signatureFieldName) throws IOException
inputFile
- The source pdf document file.signedFile
- The file to be signed.tsaClient
- optional TSA clientsignatureFieldName
- optional name of an existing (unsigned) signature fieldIOException
public static void main(String[] args) throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException
args
- KeyStoreException
CertificateException
IOException
NoSuchAlgorithmException
UnrecoverableKeyException
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.