Improve PDF reset logic and modernize UI styling

Refactor PDF reset to restore original document state using a new OriginalPdfBase64 variable and async logic. Redesign app.css with a lighter color palette, CSS variables, and updated styles for buttons, overlays, modals, and inputs for a cleaner, more accessible UI. Adjust signature and text overlay colors in pdfInterop.js for better contrast and consistency.
This commit is contained in:
OlgunR
2025-12-09 10:26:01 +01:00
parent ab3e7fb4e9
commit cd85b4fffc
3 changed files with 129 additions and 78 deletions

View File

@@ -84,6 +84,7 @@
private ElementReference OverlayRef;
private string? PdfBase64;
private string? OriginalPdfBase64;
private int PageIndex;
private int PageCount;
private double ViewportWidthPx = 800;
@@ -143,6 +144,7 @@
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
PdfBase64 = Convert.ToBase64String(ms.ToArray());
OriginalPdfBase64 = PdfBase64;
// Show the canvas before we start rendering
await InvokeAsync(StateHasChanged);
@@ -186,13 +188,28 @@
}
}
private void Reset()
private async Task Reset()
{
PdfBase64 = null;
PageIndex = 0;
PageCount = 0;
ViewportHeightPx = 0;
ErrorMessage = null;
CloseOverlays();
ShowSignaturePadModal = false;
OverlayXpx = 20;
OverlayYpx = 20;
OverlayWidthPx = 200;
OverlayHeightPx = 80;
TextValue = "Text";
if (string.IsNullOrWhiteSpace(OriginalPdfBase64))
{
return;
}
PdfBase64 = OriginalPdfBase64;
PageIndex = 0;
var result = await JS.InvokeAsync<RenderResult>("pdfInterop.loadPdf", PdfBase64);
PageCount = result.Pages;
await RenderPage();
}
private void CloseOverlays()