Refactor signature handling and add PDF signature support
Refactored `OnSignatureButtonClick` in `EnvelopeViewer.razor`: - Converted to async and added null-check for `_capturedSignature`. - Integrated `pdfViewer.applySignature` to apply signatures to PDFs. Added `applySignature` method to `pdf-viewer.js`: - Handles rendering of signatures with image, metadata, and styling. - Follows German standards for signature formatting. - Includes error handling for missing elements. Introduced `escapeHtml` helper in `pdf-viewer.js` to prevent XSS. Updated `MaxThumbnailWidth` in `EnvelopeViewer.razor` to 400. Enhanced logging for better debugging during signature application.
This commit is contained in:
@@ -566,9 +566,19 @@ const int MaxThumbnailWidth = 400;
|
||||
}
|
||||
|
||||
[JSInvokable]
|
||||
public void OnSignatureButtonClick(int signatureId) {
|
||||
Console.WriteLine($"Signature #{signatureId} clicked");
|
||||
OpenSignaturePopup();
|
||||
public async Task OnSignatureButtonClick(int signatureId) {
|
||||
if (_capturedSignature == null) {
|
||||
// No signature captured yet - should not happen as popup is shown on page load
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply signature to PDF canvas
|
||||
await JSRuntime.InvokeVoidAsync("pdfViewer.applySignature",
|
||||
signatureId,
|
||||
_capturedSignature.DataUrl,
|
||||
_capturedSignature.FullName,
|
||||
_capturedSignature.Position,
|
||||
_capturedSignature.Place);
|
||||
}
|
||||
|
||||
// Signature popup methods
|
||||
|
||||
Reference in New Issue
Block a user