Package org.apache.poi.poifs.crypt.dsig
Class SignatureLine
java.lang.Object
org.apache.poi.poifs.crypt.dsig.SignatureLine
- Direct Known Subclasses:
XSSFSignatureLine,XWPFSignatureLine
Base class for SignatureLines (XSSF,XWPF only)
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(org.apache.xmlbeans.XmlObject signatureContainer, SignatureLine.AddPictureData addPictureData) protected byte[]generateImage(boolean showSignature, boolean showInvalidStamp) Generate the image for a signature lineThe default captionbyte[]the plain signature without captioncom.microsoft.schemas.vml.CTShapeprotected voidparse()protected byte[]plainPng()Word and Excel a regenerating the valid and invalid signature line based on the plain signature.voidsetAllowComments(Boolean allowComments) voidsetCaption(String caption) Set the caption - use maximum of three lines separated by "\n".voidsetContentType(String contentType) voidsetInvalidStamp(String invalidStamp) Sets the text stamped over the signature image when the document got tampered withvoidsetPlainSignature(byte[] plainSignature) Sets the plain signature supported formats are PNG,GIF,JPEG,(SVG),EMF,WMF.protected abstract voidsetRelationId(com.microsoft.schemas.vml.CTImageData imageData, String relId) voidsetSetupId(ClassID setupId) voidsetSignatureShape(com.microsoft.schemas.office.office.CTSignatureLine signatureLine) voidsetSignatureShape(com.microsoft.schemas.vml.CTShape signatureShape) voidsetSigningInstructions(String signingInstructions) voidsetSuggestedSigner(String suggestedSigner) voidsetSuggestedSigner2(String suggestedSigner2) voidsetSuggestedSignerEmail(String suggestedSignerEmail) protected voidupdate()voidupdateSignatureConfig(SignatureConfig config)
-
Field Details
-
QNAME_SIGNATURE_LINE
-
-
Constructor Details
-
SignatureLine
public SignatureLine()
-
-
Method Details
-
getSetupId
-
setSetupId
-
getAllowComments
-
setAllowComments
-
getSigningInstructions
-
setSigningInstructions
-
getSuggestedSigner
-
setSuggestedSigner
-
getSuggestedSigner2
-
setSuggestedSigner2
-
getSuggestedSignerEmail
-
setSuggestedSignerEmail
-
getDefaultCaption
The default caption- Returns:
- "[suggestedSigner] \n [suggestedSigner2] \n [suggestedSignerEmail]"
-
getCaption
-
setCaption
Set the caption - use maximum of three lines separated by "\n". Defaults togetDefaultCaption()- Parameters:
caption- the signature caption
-
getInvalidStamp
-
setInvalidStamp
Sets the text stamped over the signature image when the document got tampered with- Parameters:
invalidStamp- the invalid stamp text
-
getPlainSignature
public byte[] getPlainSignature()the plain signature without caption -
setPlainSignature
public void setPlainSignature(byte[] plainSignature) Sets the plain signature supported formats are PNG,GIF,JPEG,(SVG),EMF,WMF. for SVG,EMF,WMF poi-scratchpad needs to be in the class-/modulepath- Parameters:
plainSignature- the plain signature - ifnull, the signature is not rendered and only the caption is visible
-
getContentType
-
setContentType
-
getSignatureShape
public com.microsoft.schemas.vml.CTShape getSignatureShape() -
setSignatureShape
public void setSignatureShape(com.microsoft.schemas.vml.CTShape signatureShape) -
setSignatureShape
public void setSignatureShape(com.microsoft.schemas.office.office.CTSignatureLine signatureLine) -
updateSignatureConfig
- Throws:
IOException
-
parse
protected void parse() -
setRelationId
protected abstract void setRelationId(com.microsoft.schemas.vml.CTImageData imageData, String relId) -
add
protected void add(org.apache.xmlbeans.XmlObject signatureContainer, SignatureLine.AddPictureData addPictureData) -
update
protected void update() -
plainPng
Word and Excel a regenerating the valid and invalid signature line based on the plain signature. Both are picky about the input format. Especially EMF images need to a specific device dimension (dpi) instead of fiddling around with the input image, we generate/register a bitmap image instead- Returns:
- the converted PNG image
- Throws:
IOException
-
generateImage
Generate the image for a signature line- Parameters:
showSignature- show signature image - usefalsefor placeholder images in to-be-signed documentsshowInvalidStamp- print invalid stamp over the signature- Returns:
- the signature image in PNG format as byte array
- Throws:
IOException
-