From c649c93921afa4fe9a71df2d8f39783d92f911ae Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 6 Nov 2025 19:51:15 +0100 Subject: [PATCH] move pdf burner to application layer --- .../Common/Configurations/PDFBurnerParams.cs | 48 +++++++++++++++++++ .../DependencyInjection.cs | 1 + .../Pdf/BurnPdfCommand.cs | 39 +++++++++++++++ .../Models/PDFBurnerParams.cs | 27 ----------- EnvelopeGenerator.PdfEditor/PDFBurner.cs | 8 ---- 5 files changed, 88 insertions(+), 35 deletions(-) create mode 100644 EnvelopeGenerator.Application/Common/Configurations/PDFBurnerParams.cs create mode 100644 EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs delete mode 100644 EnvelopeGenerator.PdfEditor/Models/PDFBurnerParams.cs delete mode 100644 EnvelopeGenerator.PdfEditor/PDFBurner.cs diff --git a/EnvelopeGenerator.Application/Common/Configurations/PDFBurnerParams.cs b/EnvelopeGenerator.Application/Common/Configurations/PDFBurnerParams.cs new file mode 100644 index 00000000..ff996d40 --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Configurations/PDFBurnerParams.cs @@ -0,0 +1,48 @@ +using System.Drawing; +using System.Diagnostics.CodeAnalysis; + +namespace EnvelopeGenerator.Application.Common.Configurations; + +/// +/// +/// +public class PDFBurnerParams +{ + /// + /// + /// + public IEnumerable IgnoredLabels { get; set; } = new List + { + "Date", "Datum", "ZIP", "PLZ", "Place", "Ort", "Position", "Stellung" + }; + + /// + /// + /// + + public double TopMargin { get; set; } = 0.1; + + + /// + /// + /// + public double YOffset { get; set; } = -0.3; + + + /// + /// + /// + public string FontName { get; set; } = "Arial"; + + + /// + /// + /// + public int FontSize { get; set; } = 8; + + /// + /// + /// + [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")] + public FontStyle FontStyle { get; set; } = FontStyle.Italic; +} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/DependencyInjection.cs b/EnvelopeGenerator.Application/DependencyInjection.cs index 59b44347..f47bfeac 100644 --- a/EnvelopeGenerator.Application/DependencyInjection.cs +++ b/EnvelopeGenerator.Application/DependencyInjection.cs @@ -46,6 +46,7 @@ public static class DependencyInjection services.Configure(config.GetSection(nameof(MailParams))); services.Configure(config.GetSection(nameof(AuthenticatorParams))); services.Configure(config.GetSection(nameof(TotpSmsParams))); + services.Configure(config.GetSection(nameof(PDFBurnerParams))); services.AddHttpClientService(config.GetSection(nameof(GtxMessagingParams))); services.TryAddSingleton(); diff --git a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs new file mode 100644 index 00000000..8a7ef063 --- /dev/null +++ b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs @@ -0,0 +1,39 @@ +using EnvelopeGenerator.Application.Common.Configurations; +using MediatR; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EnvelopeGenerator.Application.Pdf; + +/// +/// +/// +public class BurnPdfCommand : IRequest +{ +} + +/// +/// +/// +public class BurnPdfCommandHandler : IRequestHandler +{ + /// + /// + /// + private readonly PDFBurnerParams _pdfBurnerParams; + + /// + /// + /// + /// + /// + /// + /// + public Task Handle(BurnPdfCommand request, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/EnvelopeGenerator.PdfEditor/Models/PDFBurnerParams.cs b/EnvelopeGenerator.PdfEditor/Models/PDFBurnerParams.cs deleted file mode 100644 index 4b43b685..00000000 --- a/EnvelopeGenerator.PdfEditor/Models/PDFBurnerParams.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Drawing; -using System.Diagnostics.CodeAnalysis; -#if NETFRAMEWORK -using System.Collections.Generic; -#endif - -namespace EnvelopeGenerator.PdfEditor.Models -{ - public class PDFBurnerParams - { - public IEnumerable IgnoredLabels { get; set; } = new List - { - "Date", "Datum", "ZIP", "PLZ", "Place", "Ort", "Position", "Stellung" - }; - - public double TopMargin { get; set; } = 0.1; - - public double YOffset { get; set; } = -0.3; - - public string FontName { get; set; } = "Arial"; - - public int FontSize { get; set; } = 8; - - [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")] - public FontStyle FontStyle { get; set; } = FontStyle.Italic; - } -} \ No newline at end of file diff --git a/EnvelopeGenerator.PdfEditor/PDFBurner.cs b/EnvelopeGenerator.PdfEditor/PDFBurner.cs deleted file mode 100644 index 0ca1c0be..00000000 --- a/EnvelopeGenerator.PdfEditor/PDFBurner.cs +++ /dev/null @@ -1,8 +0,0 @@ -#if NET -namespace EnvelopeGenerator.PdfEditor; - -public class PDFBurner -{ -} - -#endif \ No newline at end of file