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.
This commit is contained in:
2026-05-28 19:43:03 +02:00
parent 4144d2abde
commit 7aa08cf8e9
2 changed files with 34 additions and 14 deletions

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<WasmBuildNative>false</WasmBuildNative>
<WasmBuildNative>true</WasmBuildNative>
<InvariantGlobalization>false</InvariantGlobalization>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>

View File

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