Files
DXApp/DXApp.TemplateKitProject/Program.cs
OlgunR 1ed873fc84 Add PDF signing feature with UI and backend support
Introduced a new `PdfSigningService` for digitally signing PDFs
using a PFX certificate and DevExpress's `PdfDocumentSigner`.
Updated `Program.cs` to register the service and added a new
configuration section `PdfSigning` in `appsettings.json` for
certificate management.

Added a Razor Page `TestSignature.cshtml` and its page model
`TestSignature.cshtml.cs` to provide a user interface for testing
PDF signing. The page includes file upload, signature validation,
and result display functionality.

Implemented supporting classes `PdfSigningOptions` for signature
customization and `SignatureInformation` for extracting and
displaying signature details, including signer name, location,
and certificate validity.
2026-06-23 15:32:33 +02:00

43 lines
1.4 KiB
C#

using DXApp.TemplateKitProject.Data;
using DXApp.TemplateKitProject.Services;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
// Datenbank
var connectionString = builder.Configuration.GetConnectionString("EcmContext")
?? throw new InvalidOperationException("Connection string 'EcmContext' not found.");
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(connectionString));
// Services
builder.Services.AddScoped<PdfAttachmentExtractorService>();
builder.Services.AddScoped<PdfResultPackageService>();
builder.Services.AddScoped<ZugferdExtractorService>();
builder.Services.AddScoped<ZugferdParserService>();
builder.Services.AddScoped<ZugferdImportService>();
builder.Services.AddScoped<AttachmentViewerService>();
builder.Services.AddScoped<PdfSigningService>();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
// MIME-Types für PDF.js registrieren (einmaliger UseStaticFiles-Aufruf)
var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();
provider.Mappings[".mjs"] = "text/javascript";
provider.Mappings[".ftl"] = "text/plain";
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();