Add configurable SignatureFieldParams class
Introduce `SignatureFieldParams` class to manage signature field dimensions with configurable `Width` and `Height`. Integrate this configuration into the service collection and replace hardcoded dimensions in `CreateEnvelopeCommandHandler.cs` and `SenderEditorPage.razor`. Update `appsettings.json` to include the new configuration section, allowing runtime adjustments.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class SignatureFieldParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public double Width { get; init; } = 1.77;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public double Height { get; init; } = 1.96;
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@ public static class DependencyInjection
|
|||||||
|
|
||||||
services.Configure<DispatcherParams>(config.GetSection(nameof(DispatcherParams)));
|
services.Configure<DispatcherParams>(config.GetSection(nameof(DispatcherParams)));
|
||||||
services.Configure<MailParams>(config.GetSection(nameof(MailParams)));
|
services.Configure<MailParams>(config.GetSection(nameof(MailParams)));
|
||||||
|
services.Configure<SignatureFieldParams>(config.GetSection(nameof(SignatureFieldParams)));
|
||||||
services.Configure<AuthenticatorParams>(config.GetSection(nameof(AuthenticatorParams)));
|
services.Configure<AuthenticatorParams>(config.GetSection(nameof(AuthenticatorParams)));
|
||||||
services.Configure<TotpSmsParams>(config.GetSection(nameof(TotpSmsParams)));
|
services.Configure<TotpSmsParams>(config.GetSection(nameof(TotpSmsParams)));
|
||||||
services.Configure<ESignParams>(config.GetSection(nameof(ESignParams)));
|
services.Configure<ESignParams>(config.GetSection(nameof(ESignParams)));
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public class CreateEnvelopeCommandHandler : IRequestHandler<CreateEnvelopeComman
|
|||||||
|
|
||||||
private DispatcherParams DispatcherParams => _provider.GetRequiredService<IOptions<DispatcherParams>>().Value;
|
private DispatcherParams DispatcherParams => _provider.GetRequiredService<IOptions<DispatcherParams>>().Value;
|
||||||
|
|
||||||
|
private SignatureFieldParams SignatureFieldParams => _provider.GetRequiredService<IOptionsMonitor<SignatureFieldParams>>().CurrentValue;
|
||||||
|
|
||||||
private IConfigService ConfigService => _provider.GetRequiredService<IConfigService>();
|
private IConfigService ConfigService => _provider.GetRequiredService<IConfigService>();
|
||||||
|
|
||||||
private IMediator Mediator => _provider.GetRequiredService<IMediator>();
|
private IMediator Mediator => _provider.GetRequiredService<IMediator>();
|
||||||
@@ -444,8 +446,8 @@ public class CreateEnvelopeCommandHandler : IRequestHandler<CreateEnvelopeComman
|
|||||||
ElementType = 1,
|
ElementType = 1,
|
||||||
X = field.X,
|
X = field.X,
|
||||||
Y = field.Y,
|
Y = field.Y,
|
||||||
Width = 1.77,
|
Width = SignatureFieldParams.Width,
|
||||||
Height = 1.96,
|
Height = SignatureFieldParams.Height,
|
||||||
Page = field.Page,
|
Page = field.Page,
|
||||||
Required = true,
|
Required = true,
|
||||||
ReadOnly = false,
|
ReadOnly = false,
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
@using EnvelopeGenerator.Application.Resources
|
@using EnvelopeGenerator.Application.Resources
|
||||||
@using EnvelopeGenerator.Domain.Constants
|
@using EnvelopeGenerator.Domain.Constants
|
||||||
@using EnvelopeGenerator.Domain.Resources
|
@using EnvelopeGenerator.Domain.Resources
|
||||||
|
@using EnvelopeGenerator.Application.Common.Configurations
|
||||||
@using EnvelopeGenerator.Server.Client.Components.PdfEditor
|
@using EnvelopeGenerator.Server.Client.Components.PdfEditor
|
||||||
@using EnvelopeGenerator.Server.Client.Services
|
@using EnvelopeGenerator.Server.Client.Services
|
||||||
@using Microsoft.AspNetCore.WebUtilities
|
@using Microsoft.AspNetCore.WebUtilities
|
||||||
@using Microsoft.AspNetCore.Components.Forms
|
@using Microsoft.AspNetCore.Components.Forms
|
||||||
@using Microsoft.Extensions.Localization
|
@using Microsoft.Extensions.Localization
|
||||||
|
@using Microsoft.Extensions.Options
|
||||||
@inject IJSRuntime JSRuntime
|
@inject IJSRuntime JSRuntime
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject AppVersionService AppVersion
|
@inject AppVersionService AppVersion
|
||||||
@@ -25,6 +27,7 @@
|
|||||||
@inject AuthService AuthService
|
@inject AuthService AuthService
|
||||||
@inject IStringLocalizer<Resource> UiLocalizer
|
@inject IStringLocalizer<Resource> UiLocalizer
|
||||||
@inject IStringLocalizer<Model> ModelLocalizer
|
@inject IStringLocalizer<Model> ModelLocalizer
|
||||||
|
@inject IOptionsMonitor<SignatureFieldParams> SignatureFieldOptions
|
||||||
|
|
||||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||||
<link href="_content/DevExpress.Blazor.Viewer/css/dx-blazor-viewer-components.bs5.css" rel="stylesheet" />
|
<link href="_content/DevExpress.Blazor.Viewer/css/dx-blazor-viewer-components.bs5.css" rel="stylesheet" />
|
||||||
@@ -598,10 +601,11 @@
|
|||||||
[SupplyParameterFromQuery(Name = "bootstrapToken")]
|
[SupplyParameterFromQuery(Name = "bootstrapToken")]
|
||||||
public string? BootstrapToken { get; set; }
|
public string? BootstrapToken { get; set; }
|
||||||
|
|
||||||
// ── Constants ──
|
// ── Signature field size (configurable) ──
|
||||||
// Signature field size in PDF points (fixed): 1.77" × 1.96"
|
double SigWidthInches => SignatureFieldOptions.CurrentValue.Width;
|
||||||
const double SigWidthPt = 1.77 * 72; // 127.44 pt
|
double SigHeightInches => SignatureFieldOptions.CurrentValue.Height;
|
||||||
const double SigHeightPt = 1.96 * 72; // 141.12 pt
|
double SigWidthPt => SigWidthInches * 72.0;
|
||||||
|
double SigHeightPt => SigHeightInches * 72.0;
|
||||||
|
|
||||||
// CssClass for JS click coordinate helper
|
// CssClass for JS click coordinate helper
|
||||||
const string ViewerCssClass = "sender-editor-pdf-viewer";
|
const string ViewerCssClass = "sender-editor-pdf-viewer";
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using DevExpress.XtraReports.Web.Extensions;
|
|||||||
using DevExpress.DataAccess.Web;
|
using DevExpress.DataAccess.Web;
|
||||||
using DevExpress.XtraReports.Services;
|
using DevExpress.XtraReports.Services;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||||
|
|
||||||
@@ -31,6 +32,8 @@ builder.Services.AddScoped(sp => new HttpClient
|
|||||||
// Configuration Options
|
// Configuration Options
|
||||||
builder.Services.Configure<PdfViewerOptions>(opts =>
|
builder.Services.Configure<PdfViewerOptions>(opts =>
|
||||||
builder.Configuration.GetSection(PdfViewerOptions.SectionName).Bind(opts));
|
builder.Configuration.GetSection(PdfViewerOptions.SectionName).Bind(opts));
|
||||||
|
builder.Services.Configure<SignatureFieldParams>(opts =>
|
||||||
|
builder.Configuration.GetSection(nameof(SignatureFieldParams)).Bind(opts));
|
||||||
|
|
||||||
// Business Services
|
// Business Services
|
||||||
builder.Services.AddScoped<DocumentService>();
|
builder.Services.AddScoped<DocumentService>();
|
||||||
|
|||||||
@@ -58,6 +58,10 @@
|
|||||||
"MainCanvasEnableHiDPI": true,
|
"MainCanvasEnableHiDPI": true,
|
||||||
"ZoomStepPercentage": 5
|
"ZoomStepPercentage": 5
|
||||||
},
|
},
|
||||||
|
"SignatureFieldParams": {
|
||||||
|
"Width": 1.77,
|
||||||
|
"Height": 1.96
|
||||||
|
},
|
||||||
"DocumentService": {
|
"DocumentService": {
|
||||||
"BaseUrl": "http://172.24.12.39:9393"
|
"BaseUrl": "http://172.24.12.39:9393"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,5 +14,9 @@
|
|||||||
"RenderingOpacity": 0.85,
|
"RenderingOpacity": 0.85,
|
||||||
"ThumbnailRenderDelay": 50,
|
"ThumbnailRenderDelay": 50,
|
||||||
"ZoomStepPercentage": 5
|
"ZoomStepPercentage": 5
|
||||||
|
},
|
||||||
|
"SignatureFieldParams": {
|
||||||
|
"Width": 1.77,
|
||||||
|
"Height": 1.96
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user