From 7aa08cf8e9ce5e2487a0e62972cdf281b872fb31 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 28 May 2026 19:43:03 +0200 Subject: [PATCH] Enable Wasm native build and refactor signature layout Updated EnvelopeGenerator.ReceiverUI.csproj to enable native WebAssembly builds and load all globalization data for improved localization support. Refactored ReportViewer.razor to enhance layout calculations for the signature section: - Introduced constants for better readability and maintainability. - Dynamically adjusted band height and padding to fit content without overlap. - Updated control positioning and sizing using calculated values. - Changed font style of the signature label to regular and reordered control additions for clarity. --- .../EnvelopeGenerator.ReceiverUI.csproj | 2 +- .../Pages/ReportViewer.razor | 46 +++++++++++++------ 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/EnvelopeGenerator.ReceiverUI/EnvelopeGenerator.ReceiverUI.csproj b/EnvelopeGenerator.ReceiverUI/EnvelopeGenerator.ReceiverUI.csproj index 966a0c1b..19f0416c 100644 --- a/EnvelopeGenerator.ReceiverUI/EnvelopeGenerator.ReceiverUI.csproj +++ b/EnvelopeGenerator.ReceiverUI/EnvelopeGenerator.ReceiverUI.csproj @@ -2,7 +2,7 @@ net8.0 enable - false + true false true diff --git a/EnvelopeGenerator.ReceiverUI/Pages/ReportViewer.razor b/EnvelopeGenerator.ReceiverUI/Pages/ReportViewer.razor index d69c487f..35a90f86 100644 --- a/EnvelopeGenerator.ReceiverUI/Pages/ReportViewer.razor +++ b/EnvelopeGenerator.ReceiverUI/Pages/ReportViewer.razor @@ -291,33 +291,53 @@ report.Bands.Add(bottomMargin); } - bottomMargin.HeightF = Math.Max(bottomMargin.HeightF, 175F); RemoveExistingSignature(bottomMargin); + // Layout constants + const float sigX = 390F; + const float sigWidth = 230F; + const float sigImgHeight = 70F; + const float infoHeight = 65F; // up to 4 lines at 8pt + const float innerGap = 5F; + const float bottomPad = 6F; + const float defaultTopPad = 8F; + const float maxBandHeight = 210F; + + float requiredHeight = defaultTopPad + sigImgHeight + innerGap + infoHeight + bottomPad; + + // Grow band if needed, but cap at maxBandHeight to avoid overlapping page content + bottomMargin.HeightF = Math.Min(maxBandHeight, Math.Max(bottomMargin.HeightF, requiredHeight)); + + // If band is tighter than required, compress top padding so content still fits + float topPad = Math.Max(0F, bottomMargin.HeightF - bottomPad - infoHeight - innerGap - sigImgHeight); + + float imageY = topPad; + float labelY = imageY + sigImgHeight + innerGap; + var signatureInformation = string.IsNullOrWhiteSpace(signerPosition) ? $"Empfaengerunterschrift\n{signerFullName}\n{signaturePlace}, {DateTime.Now:d}" : $"Empfaengerunterschrift\n{signerFullName}\n{signerPosition}\n{signaturePlace}, {DateTime.Now:d}"; - var signatureLabel = new XRLabel { - Name = "receiverSignatureLabel", - Text = signatureInformation, - Multiline = true, - BoundsF = new RectangleF(390F, 6F, 230F, 70F), - Font = new DXFont("Open Sans", 8F, DXFontStyle.Bold), - ForeColor = System.Drawing.Color.FromArgb(73, 80, 87), - TextAlignment = TextAlignment.TopLeft - }; - var signature = new XRPictureBox { Name = "receiverSignatureImage", ImageSource = imageSource, - BoundsF = new RectangleF(390F, 80F, 230F, 70F), + BoundsF = new RectangleF(sigX, imageY, sigWidth, sigImgHeight), Sizing = ImageSizeMode.ZoomImage, Borders = BorderSide.Bottom, BorderColor = System.Drawing.Color.FromArgb(73, 80, 87) }; - bottomMargin.Controls.AddRange(new XRControl[] { signatureLabel, signature }); + var signatureLabel = new XRLabel { + Name = "receiverSignatureLabel", + Text = signatureInformation, + Multiline = true, + BoundsF = new RectangleF(sigX, labelY, sigWidth, infoHeight), + Font = new DXFont("Open Sans", 8F, DXFontStyle.Regular), + ForeColor = System.Drawing.Color.FromArgb(73, 80, 87), + TextAlignment = TextAlignment.TopLeft + }; + + bottomMargin.Controls.AddRange(new XRControl[] { signature, signatureLabel }); } static void RemoveExistingSignature(BottomMarginBand bottomMargin) {