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,
FileInputStream imageStream)
Set visible signature designer for an existing signature field.
|
void |
setVisibleSignDesigner(String filename,
int x,
int y,
int zoomPercent,
FileInputStream imageStream,
int page)
Set visible signature designer for a new signature field.
|
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, setCertificateChain, 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
filename
- x
- position of the signature fieldy
- position of the signature fieldzoomPercent
- imageStream
- page
- the signature should be placed onIOException
public void setVisibleSignDesigner(int zoomPercent, FileInputStream imageStream) throws IOException
zoomPercent
- imageStream
- IOException
public void setVisibleSignatureProperties(String name, String location, String reason, int preferredSize, int page, boolean visualSignEnabled) throws IOException
name
- location
- reason
- preferredSize
- page
- visualSignEnabled
- IOException
public void setVisibleSignatureProperties(String name, String location, String reason, boolean visualSignEnabled) throws IOException
name
- location
- reason
- visualSignEnabled
- 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.