Class SignatureOptions
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions
- All Implemented Interfaces:
Closeable,AutoCloseable
This contains the visual signature as a COSDocument, its preferred size and the page.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the visual signature COSDocument, if any.intgetPage()Get the 0-based page number.intGet the preferred size of the signature.Get the visual signature.voidsetPage(int pageNo) Set the 0-based page number.voidsetPreferredSignatureSize(int size) Set the preferred size of the signature.voidsetVisualSignature(File file) Reads the visual signature from the given file.voidReads the visual signature from the given input stream.voidsetVisualSignature(PDVisibleSigProperties visSignatureProperties) Reads the visual signature from the given visual signature properties
-
Field Details
-
DEFAULT_SIGNATURE_SIZE
public static final int DEFAULT_SIGNATURE_SIZE- See Also:
-
-
Constructor Details
-
SignatureOptions
public SignatureOptions()Creates the default signature options.
-
-
Method Details
-
setPage
public void setPage(int pageNo) Set the 0-based page number.- Parameters:
pageNo- the page number
-
getPage
public int getPage()Get the 0-based page number.- Returns:
- the page number
-
setVisualSignature
Reads the visual signature from the given file.- Parameters:
file- the file containing the visual signature- Throws:
IOException- when something went wrong during parsing
-
setVisualSignature
Reads the visual signature from the given input stream.- Parameters:
is- the input stream containing the visual signature- Throws:
IOException- when something went wrong during parsing
-
setVisualSignature
Reads the visual signature from the given visual signature properties- Parameters:
visSignatureProperties- thePDVisibleSigPropertiesobject containing the visual signature- Throws:
IOException- when something went wrong during parsing
-
getVisualSignature
Get the visual signature.- Returns:
- the visual signature
-
getPreferredSignatureSize
public int getPreferredSignatureSize()Get the preferred size of the signature.- Returns:
- the preferred size of the signature in bytes.
-
setPreferredSignatureSize
public void setPreferredSignatureSize(int size) Set the preferred size of the signature.- Parameters:
size- the size of the signature in bytes. Only values above 0 will be considered.
-
close
Closes the visual signature COSDocument, if any. Do not call this before you're saved your signed PDF document, or saving will fail because COSStream objects held both by the COSDocument and by the signed document would no longer be available.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if the document could not be closed
-