Package com.logicaldoc.sign.pdf
Class CreateVisibleSignature
java.lang.Object
com.logicaldoc.sign.pdf.CreateSignatureBase
com.logicaldoc.sign.pdf.CreateVisibleSignature
- All Implemented Interfaces:
- org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
Visually signs a PDF with pdf box. A keystore can be created with the java
 keytool.
- Since:
- 7.7.2
- Author:
- Marco Meschieri - LogicalDOC
- 
Constructor SummaryConstructorsConstructorDescriptionCreateVisibleSignature(File ksFile, String keyStorePassword, String alias, String aliasPassword) Initialize the signature creator with a keystore and certficate password
- 
Method SummaryModifier and TypeMethodDescriptionbooleanvoidsetLateExternalSigning(boolean lateExternalSigning) Set late external signing.voidsetVisibleSignatureProperties(String name, String location, String reason, int preferredSize, int page, boolean visualSignEnabled) Set visible signature properties for new signature fields.voidsetVisibleSignDesigner(String filename, int x, int y, int zoomPercent, FileInputStream imageStream, int page) Set visible signature designer for a new signature field.voidsetVisibleSignDesigner(String filename, int x, int y, Integer width, Integer height, FileInputStream imageStream, int page) Set visible signature designer for a new signature field.voidSign pdf file and create new fileMethods inherited from class com.logicaldoc.sign.pdf.CreateSignatureBasegetMDPPermission, isExternalSigning, setCertificateChain, setExternalSigning, setMDPPermission, setPrivateKey, sign
- 
Constructor Details- 
CreateVisibleSignaturepublic CreateVisibleSignature(File ksFile, String keyStorePassword, String alias, String aliasPassword) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, IOException, CertificateException Initialize the signature creator with a keystore and certficate password- Parameters:
- ksFile- the java keystore file containing the signing certificate
- keyStorePassword- the password for opening the keystore
- alias- the alias of the certificate
- aliasPassword- the password to open the alias
- Throws:
- KeyStoreException- if the keystore has not been initialized (loaded)
- NoSuchAlgorithmException- if the algorithm for recovering the key cannot be found
- UnrecoverableKeyException- if the given password is wrong
- CertificateException- if the certificate is not valid as signing time
- IOException- if no certificate could be found
 
 
- 
- 
Method Details- 
isLateExternalSigningpublic boolean isLateExternalSigning()
- 
setLateExternalSigningpublic 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
 
- 
setVisibleSignDesignerpublic 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
 
- 
setVisibleSignDesignerpublic 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
 
- 
setVisibleSignaturePropertiespublic 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
 
- 
signPDFSign 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
 
 
-