Skip to content

Commit

Permalink
Added Lock handling to "Signer > Various > Get existing signature fie…
Browse files Browse the repository at this point in the history
…lds" demo.
  • Loading branch information
JanSlabon committed Dec 19, 2023
1 parent 43a2910 commit 2022040
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Binary file added assets/pdfs/misc/4-rects-signed-and-locked.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
$assetsDirectory . '/pdfs/tektown/Laboratory-Report-signed.pdf',
$assetsDirectory . '/pdfs/tektown/Laboratory-Report-signed-no-LTV.pdf',
$assetsDirectory . '/pdfs/tektown/Order-Form.pdf',
$assetsDirectory . '/pdfs/lenstown/Laboratory-Report-signed-PAdES.pdf'
$assetsDirectory . '/pdfs/lenstown/Laboratory-Report-signed-PAdES.pdf',
$assetsDirectory . '/pdfs/misc/4-rects-signed-and-locked.pdf'
];

$path = displayFiles($files);
Expand All @@ -23,5 +24,22 @@
echo '<b>NOT</b>';
}

echo ' used/signed.<br/><br/>';
echo ' used/signed.<br/>';
$lock = $field->getLock();
if (is_array($lock)) {
if ($lock['action'] === SetaPDF_Signer_SignatureField::LOCK_DOCUMENT_ALL) {
echo '&nbsp;&nbsp;The document is locked by "' . htmlspecialchars($signatureFieldName) . '"<br/>';
} elseif ($lock['action'] === SetaPDF_Signer_SignatureField::LOCK_DOCUMENT_INCLUDE) {
echo '&nbsp;&nbsp;Fields are locked by "' . htmlspecialchars($signatureFieldName) . '"<br/>';
echo '<pre>';
var_dump(array_map(['SetaPDF_Core_Encoding', 'convertPdfString'], $lock['fields']));
echo '</pre>';
} elseif ($lock['action'] === SetaPDF_Signer_SignatureField::LOCK_DOCUMENT_EXCLUDE) {
echo '&nbsp;&nbsp;Fields are not locked by "' . htmlspecialchars($signatureFieldName) . '"<br/>';
echo '<pre>';
var_dump(array_map(['SetaPDF_Core_Encoding', 'convertPdfString'], $lock['fields']));
echo '</pre>';
}
}
echo '<br/>';
}

0 comments on commit 2022040

Please sign in to comment.