Class Signer
- java.lang.Object
-
- com.pdftools.internal.NativeBase
-
- com.pdftools.internal.NativeObject
-
- com.pdftools.sign.Signer
-
public class Signer extends NativeObject
Process signatures and signature fields
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Signer.Warning
Event for non-critical errors occurring during signature processingstatic interface
Signer.WarningListener
Listener interface for theSigner.Warning
event.
-
Constructor Summary
Constructors Constructor Description Signer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PreparedDocument
addPreparedSignature(Document document, SignatureConfiguration configuration, Stream stream)
Add a prepared signaturePreparedDocument
addPreparedSignature(Document document, SignatureConfiguration configuration, Stream stream, OutputOptions outputOptions)
Add a prepared signatureDocument
addSignatureField(Document document, SignatureFieldOptions options, Stream stream)
Add an unsigned signature fieldDocument
addSignatureField(Document document, SignatureFieldOptions options, Stream stream, OutputOptions outputOptions)
Add an unsigned signature fieldDocument
addTimestamp(Document document, TimestampConfiguration configuration, Stream stream)
Add a document time-stampDocument
addTimestamp(Document document, TimestampConfiguration configuration, Stream stream, OutputOptions outputOptions)
Add a document time-stampvoid
addWarningListener(Signer.WarningListener listener)
Add a listener for theSigner.Warning
event.Document
certify(Document document, SignatureConfiguration configuration, Stream stream)
Add a document certification signatureDocument
certify(Document document, SignatureConfiguration configuration, Stream stream, MdpPermissionOptions permissions)
Add a document certification signatureDocument
certify(Document document, SignatureConfiguration configuration, Stream stream, MdpPermissionOptions permissions, OutputOptions outputOptions)
Add a document certification signatureDocument
process(Document document, Stream stream)
Process a documentDocument
process(Document document, Stream stream, OutputOptions outputOptions)
Process a documentDocument
process(Document document, Stream stream, OutputOptions outputOptions, Provider provider)
Process a documentvoid
removeWarningListener(Signer.WarningListener listener)
Remove registered listener for theSigner.Warning
event.Document
sign(Document document, SignatureConfiguration configuration, Stream stream)
Add a document signatureDocument
sign(Document document, SignatureConfiguration configuration, Stream stream, OutputOptions outputOptions)
Add a document signatureDocument
signPreparedSignature(Document document, SignatureConfiguration configuration, Stream stream)
Sign a prepared signature-
Methods inherited from class com.pdftools.internal.NativeObject
equals, hashCode
-
-
-
-
Method Detail
-
addWarningListener
public void addWarningListener(Signer.WarningListener listener)
Add a listener for theSigner.Warning
event.- Parameters:
listener
- Listener for theSigner.Warning
event. If a listener is added that is already registered, it is ignored.
-
removeWarningListener
public void removeWarningListener(Signer.WarningListener listener)
Remove registered listener for theSigner.Warning
event.- Parameters:
listener
- Listener for theSigner.Warning
event that should be removed. If the listener is not registered, it is ignored.
-
sign
public Document sign(Document document, SignatureConfiguration configuration, Stream stream) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Add a document signature
Document signatures are sometimes also called approval signatures. This type of signature lets you verify the integrity of the signed part of the document and authenticate the signer’s identity.
The features and format of the signature are defined by the
pdftools.crypto.providers.Provider
and theconfiguration
.Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to signconfiguration
- The signature configurationstream
- The stream where the signed document is written- Returns:
- The signed document
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because it has been revoked.NotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.NotFoundException
- If an image, a PDF or a font file for the visual appearance could not be found.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
sign
public Document sign(Document document, SignatureConfiguration configuration, Stream stream, OutputOptions outputOptions) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Add a document signature
Document signatures are sometimes also called approval signatures. This type of signature lets you verify the integrity of the signed part of the document and authenticate the signer’s identity.
The features and format of the signature are defined by the
pdftools.crypto.providers.Provider
and theconfiguration
.Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to signconfiguration
- The signature configurationstream
- The stream where the signed document is writtenoutputOptions
- Document-level output options not directly related to the signature- Returns:
- The signed document
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because it has been revoked.NotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.NotFoundException
- If an image, a PDF or a font file for the visual appearance could not be found.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
certify
public Document certify(Document document, SignatureConfiguration configuration, Stream stream) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Add a document certification signature
This type of signature lets you detect rejected changes specified by the author. These signatures are also called Modification Detection and Prevention (MDP) signatures. The allowed permissions are defined by
permissions
.The features and format of the signature are defined by the
pdftools.crypto.providers.Provider
and theconfiguration
.Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to certifyconfiguration
- The signature configurationstream
- The stream where the certified document is written- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.NotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
certify
public Document certify(Document document, SignatureConfiguration configuration, Stream stream, MdpPermissionOptions permissions) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Add a document certification signature
This type of signature lets you detect rejected changes specified by the author. These signatures are also called Modification Detection and Prevention (MDP) signatures. The allowed permissions are defined by
permissions
.The features and format of the signature are defined by the
pdftools.crypto.providers.Provider
and theconfiguration
.Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to certifyconfiguration
- The signature configurationstream
- The stream where the certified document is writtenpermissions
- The permissions allowed. The default ispdftools.pdf.MdpPermissions.NO_CHANGES
.- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.NotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
certify
public Document certify(Document document, SignatureConfiguration configuration, Stream stream, MdpPermissionOptions permissions, OutputOptions outputOptions) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Add a document certification signature
This type of signature lets you detect rejected changes specified by the author. These signatures are also called Modification Detection and Prevention (MDP) signatures. The allowed permissions are defined by
permissions
.The features and format of the signature are defined by the
pdftools.crypto.providers.Provider
and theconfiguration
.Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to certifyconfiguration
- The signature configurationstream
- The stream where the certified document is writtenpermissions
- The permissions allowed. The default ispdftools.pdf.MdpPermissions.NO_CHANGES
.outputOptions
- Document-level output options not directly related to the document certification- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.NotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
addTimestamp
public Document addTimestamp(Document document, TimestampConfiguration configuration, Stream stream) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Add a document time-stamp
This type of signature provides evidence that the document existed at a specific time and protects the document’s integrity.
The features and format of the signature are defined by the
pdftools.crypto.providers.Provider
and theconfiguration
.Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to add a time-stamp toconfiguration
- The time-stamp configurationstream
- The stream where the output document is written- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.NotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
addTimestamp
public Document addTimestamp(Document document, TimestampConfiguration configuration, Stream stream, OutputOptions outputOptions) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Add a document time-stamp
This type of signature provides evidence that the document existed at a specific time and protects the document’s integrity.
The features and format of the signature are defined by the
pdftools.crypto.providers.Provider
and theconfiguration
.Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to add a time-stamp toconfiguration
- The time-stamp configurationstream
- The stream where the output document is writtenoutputOptions
- Document-level output options not directly related to the document time-stamp- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.NotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
addSignatureField
public Document addSignatureField(Document document, SignatureFieldOptions options, Stream stream) throws java.io.IOException, LicenseException, UnsupportedFeatureException, ExistsException
Add an unsigned signature field
Add an unsigned signature field that can later be signed (see
pdftools.pdf.UnsignedSignatureField
).Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to add the signature field tooptions
- The options for the unsigned signature fieldstream
- The stream where the output document is written- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.ExistsException
- TheSignatureFieldOptions.getFieldName()
exists already in the input document.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifoptions
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
addSignatureField
public Document addSignatureField(Document document, SignatureFieldOptions options, Stream stream, OutputOptions outputOptions) throws java.io.IOException, LicenseException, UnsupportedFeatureException, ExistsException
Add an unsigned signature field
Add an unsigned signature field that can later be signed (see
pdftools.pdf.UnsignedSignatureField
).Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to add the signature field tooptions
- The options for the unsigned signature fieldstream
- The stream where the output document is writtenoutputOptions
- Document-level output options not directly related to the signature field- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.ExistsException
- TheSignatureFieldOptions.getFieldName()
exists already in the input document.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifoptions
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
addPreparedSignature
public PreparedDocument addPreparedSignature(Document document, SignatureConfiguration configuration, Stream stream) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, HttpException
Add a prepared signature
Adding a prepared signature is only required in very particular or specialized use cases. This method is the same as
sign(com.pdftools.pdf.Document, com.pdftools.sign.SignatureConfiguration, com.pdftools.sys.Stream)
, but without actually creating the cryptographic signature. The cryptographic signature can be inserted later usingsignPreparedSignature(com.pdftools.pdf.Document, com.pdftools.sign.SignatureConfiguration, com.pdftools.sys.Stream)
.While the
configuration
can be created by anypdftools.crypto.providers.Provider
, it is typically created bypdftools.crypto.providers.builtin.Provider.createPreparedSignature
.- Parameters:
document
- The input document to add the prepared signatureconfiguration
- The signature configurationstream
- The stream where the output document is written- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closedNotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL).java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
addPreparedSignature
public PreparedDocument addPreparedSignature(Document document, SignatureConfiguration configuration, Stream stream, OutputOptions outputOptions) throws java.io.IOException, NotFoundException, LicenseException, UnsupportedFeatureException, HttpException
Add a prepared signature
Adding a prepared signature is only required in very particular or specialized use cases. This method is the same as
sign(com.pdftools.pdf.Document, com.pdftools.sign.SignatureConfiguration, com.pdftools.sys.Stream)
, but without actually creating the cryptographic signature. The cryptographic signature can be inserted later usingsignPreparedSignature(com.pdftools.pdf.Document, com.pdftools.sign.SignatureConfiguration, com.pdftools.sys.Stream)
.While the
configuration
can be created by anypdftools.crypto.providers.Provider
, it is typically created bypdftools.crypto.providers.builtin.Provider.createPreparedSignature
.- Parameters:
document
- The input document to add the prepared signatureconfiguration
- The signature configurationstream
- The stream where the output document is writtenoutputOptions
- Document-level output options not directly related to preparing the signature- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closedNotFoundException
- If theSignatureConfiguration.getFieldName()
does not exist indocument
.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL).java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
signPreparedSignature
public Document signPreparedSignature(Document document, SignatureConfiguration configuration, Stream stream) throws java.io.IOException, LicenseException, UnsupportedFeatureException, PermissionException, HttpException, RetryException
Sign a prepared signature
Sign a document that contains a prepared signature created usingaddPreparedSignature(com.pdftools.pdf.Document, com.pdftools.sign.SignatureConfiguration, com.pdftools.sys.Stream)
. Note that theconfiguration
must be compatible to the configuration used when preparing the signature.- Parameters:
document
- The input document to signconfiguration
- The signature configurationstream
- The stream where the signed document is written- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.java.lang.IllegalArgumentException
- If thedocument
does not contain a prepared signature created byaddPreparedSignature(com.pdftools.pdf.Document, com.pdftools.sign.SignatureConfiguration, com.pdftools.sys.Stream)
java.lang.IllegalArgumentException
- If theconfiguration
is invalid, e.g. because the creating provider has been closed.RetryException
- If an unexpected error occurs that can be resolved by retrying the operation. For example, if a signature service returns an unexpectedly large signature.RetryException
- If a resource required by the cryptographic provider is temporarily unavailable.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL) or a time-stamp.UnsupportedFeatureException
- If the cryptographic provider does not support the requested signing algorithm.PermissionException
- If the cryptographic provider does not allow the signing operation.java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifconfiguration
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
process
public Document process(Document document, Stream stream) throws java.io.IOException, LicenseException, UnsupportedFeatureException, HttpException
Process a document
Apply document-level processing options without any signature operation. For example:
- To encrypt or decrypt PDF documents that may be signed (see the samples "Encrypt" and "Decrypt").
-
To remove signatures and unsigned signature fields (see
OutputOptions.getRemoveSignatures()
). -
To add validation information to existing signatures (see
OutputOptions.getAddValidationInformation()
).
Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to processstream
- The stream where the output document is written- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL).java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
process
public Document process(Document document, Stream stream, OutputOptions outputOptions) throws java.io.IOException, LicenseException, UnsupportedFeatureException, HttpException
Process a document
Apply document-level processing options without any signature operation. For example:
- To encrypt or decrypt PDF documents that may be signed (see the samples "Encrypt" and "Decrypt").
-
To remove signatures and unsigned signature fields (see
OutputOptions.getRemoveSignatures()
). -
To add validation information to existing signatures (see
OutputOptions.getAddValidationInformation()
).
Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to processstream
- The stream where the output document is writtenoutputOptions
- The document-level processing options- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL).java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
process
public Document process(Document document, Stream stream, OutputOptions outputOptions, Provider provider) throws java.io.IOException, LicenseException, UnsupportedFeatureException, HttpException
Process a document
Apply document-level processing options without any signature operation. For example:
- To encrypt or decrypt PDF documents that may be signed (see the samples "Encrypt" and "Decrypt").
-
To remove signatures and unsigned signature fields (see
OutputOptions.getRemoveSignatures()
). -
To add validation information to existing signatures (see
OutputOptions.getAddValidationInformation()
).
Non-critical processing errors raise a
Signer.WarningListener
. It is recommended to review theWarningCategory
and handle them if necessary for the application.- Parameters:
document
- The input document to processstream
- The stream where the output document is writtenoutputOptions
- The document-level processing optionsprovider
- The cryptographic provider to use to add validation information to existing signatures of input document (seeOutputOptions.getAddValidationInformation()
). Can benull
if no validation information is added or to use the default provider.- Returns:
- Throws:
LicenseException
- The license check has failed.java.io.IOException
- Writing to thestream
failed.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.HttpException
- If a network error occurs, e.g. downloading revocation information (OCSP, CRL).java.lang.IllegalArgumentException
- ifdocument
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
-