Configure Digital Signature Appearance in Android: Visible vs. Non-Visible Signatures

PSPDFKit offers comprehensive support for creating digital signatures, encompassing both visible and invisible signatures. The primary distinction between these two types lies in the customizable appearance aspect. Visible digital signatures, as the name suggests, are visually represented on a document, allowing users to easily identify and interact with them. Meanwhile, invisible digital signatures remain hidden within a document, leaving no visual trace. However, both types of signatures provide the same level of security and validity, ensuring the integrity of a digital document.

Visible Digital Signatures

To configure the appearance of a signed document using the SigningManager.signDocument function, create a DigitalSignatureMetadata object and customize the signatureAppearance field. With the SignatureAppearance object, you can customize various visual properties, outlined below.

  • Set the SignatureAppearanceMode. This can be one of:

    • SIGNATURE_ONLY — Only the signature is displayed.

    • SIGNATURE_AND_DESCRIPTION — Both the signature and a description are displayed. This is the default.

    • DESCRIPTION_ONLY — Only the description is displayed.

  • Set a SignatureGraphic — Optionally use a bitmap or PDF for the signature appearance.

  • Show/hide signer name

  • Show/hide location

  • Show/hide date

  • Show/hide PSPDFKit watermark

The DigitalSignatureMetadata object can be set on SignerOptions, which is then passed to signDocument for signing. For example:

// Configure appearance.
val appearance = SignatureAppearance.Builder()
	.setSignatureAppearanceMode(SignatureAppearanceMode.SIGNATURE_ONLY)
	.build()

// Configure the metadata. val metadata = DigitalSignatureMetadata( signatureAppearance = appearance // .. add other metadata here, for example TimestampData )

// Create the options object. val signerOptions = SignerOptions.Builder(field, outputFile) .setPrivateKey(key) .setSignatureMetadata(metadata) .build()

// Sign the document. SigningManager.signDocument( context = context, signerOptions = signerOptions, type = digitalSignatureType, onFailure = {} ) { // On success. }

The table below shows an example of what each signature appearance mode looks like by default.

Signature Mode Example
signatureOnly Digital signature with signatureOnly appearance mode.
descriptionOnly Digital signature with descriptionOnly appearance mode.
signatureAndDescription Digital signature with signatureAndDescription appearance mode.

By default, the signature watermark is set to the PSPDFKit logo. If you want to remove the watermark, set showWatermark to false. If you want to use a different logo, customize the watermarkImage property. Supported file types for the logo are PDF, JPEG, and PNG.

The other properties (showSigner, showReason, showLocation, and showSignDate) configure whether the signer’s name, reason, location, and sign date should be displayed, respectively.

Invisible Digital Signatures

Invisible digital signatures don’t have any appearance. As described in the add a signature field guide, you can create an invisible digital signature by setting its boundingBox property to have a width and height of zero. This ensures that the signature remains hidden from view but still retains its cryptographic properties and validity. To see how invisible digital signatures function in practice, you can explore our demo.

Launch Demo