// now let's create a signer instance
$signer = new SetaPDF_Signer($document);
$signer->setAllowSignatureContentLengthChange(false);
$signer->setSignatureContentLength(32000);
// set some signature properties
$signer->setLocation($_SERVER['SERVER_NAME']);
$signer->setContactInfo('+01 2345 67890123');
$signer->setReason('testing...');
// create an Swisscom AIS module instance
$module = new SetaPDF_Signer_SwisscomAIS_Module($customerId, $clientOptions);
// let's add PADES revoke information to the resulting signatures
$module->setAddRevokeInformation('PADES');
// additionally the signature should include a qualified timestamp
$module->setAddTimestamp(true);
// set on-demand options
$module->setOnDemandOptions($signerDn);
if ($approvalNo !== '') {
    $module->setOnDemandOptions($signerDn, $approvalNo, $approvalMsg, $approvalLang, $approvalSn);
}
try {
    // sign the document with the use of the module
    $signer->sign($module);
    // get information about the signing certificate:
    // $signatureData = SetaPDF_Signer_SwisscomAIS_Helper::getSignatureData($module);
    // echo("Signed by: " . $signatureData['subject'] . PHP_EOL);
    // echo("Unique Mobile ID serial number: " . $signatureData['MIDSN'] . PHP_EOL);
} catch (SetaPDF_Signer_SwisscomAIS_Exception $e) {
    echo 'Error in SwisscomAIS: ' . $e->getMessage() . ' with code ' . $e->getCode() . '<br />';
    /* Get the AIS Error details */
    echo "<pre>";
    var_dump($e->getResultMajor());