signDocument

fun signDocument(context: Context, signerOptions: SignerOptions, customSigning: suspend (ByteArray, String) -> ByteArray? = null, onFailure: (Throwable) -> Unit, onSuccess: () -> Unit)

signDocument provides functionality to insert a digital signature in a document

Parameters

context
signerOptions

contains various configurations needed for the signing. This can be further looked into com.pspdfkit.signatures.SignerOptions

customSigning

if you want custom signing behaviour, add it here. For example sending the data to an external system to sign. Otherwise this can be null and the private key in com.pspdfkit.signatures.SignerOptions will be used. This lambda is run on a background IO thread (with Dispatchers.IO coroutine).

onFailure

is called when any exception is thrown

onSuccess

provides a callback where customer can use com.pspdfkit.signatures.SignerOptions.outputDataProvider as a result param.


fun signDocument(context: Context, signerOptions: SignerOptions, type: DigitalSignatureType = DigitalSignatureType.CADES, customSigning: suspend (ByteArray, String) -> ByteArray? = null, onFailure: (Throwable) -> Unit, onSuccess: () -> Unit)

Deprecated

Since 2024.4. `Type` is set via SignerOptions.

Replace with

signDocument(Context, SignerOptions, (suspend (ByteArray, String) -> ByteArray)?, (Throwable) -> Unit,() -> Unit)

signDocument provides functionality to insert a digital signature in a document

Parameters

context
signerOptions

contains various configurations needed for the signing. This can be further looked into com.pspdfkit.signatures.SignerOptions

type

can be either BASIC or CADES (default) (unused - use SignerOptions.type instead).

customSigning

if you want custom signing behaviour, add it here. For example sending the data to an external system to sign. Otherwise this can be null and the private key in com.pspdfkit.signatures.SignerOptions will be used. This lambda is run on a background IO thread (with Dispatchers.IO coroutine).

onFailure

is called when any exception is thrown

onSuccess

provides a callback where customer can use com.pspdfkit.signatures.SignerOptions.outputDataProvider as a result param.