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) {