Refactor PDFMerger for DI and remove BaseClass inheritance

PDFMerger now uses dependency injection for LicenseManager and
AnnotationManager, improving modularity and testability. Removed
inheritance from BaseClass and cleaned up unused usings.
This commit is contained in:
2026-02-26 17:24:13 +01:00
parent 79d2636c14
commit 6fac1cd96a

View File

@@ -1,12 +1,10 @@
using System.IO;
using DigitalData.Modules.Base;
using DigitalData.Modules.Logging;
using EnvelopeGenerator.ServiceHost.Exceptions; using EnvelopeGenerator.ServiceHost.Exceptions;
using GdPicture14; using GdPicture14;
using Microsoft.Extensions.Options;
namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument; namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
public class PDFMerger : BaseClass public class PDFMerger
{ {
private readonly AnnotationManager _manager; private readonly AnnotationManager _manager;
private readonly LicenseManager _licenseManager; private readonly LicenseManager _licenseManager;
@@ -16,12 +14,10 @@ public class PDFMerger : BaseClass
private readonly PdfConversionConformance _pdfaConformanceLevel = PdfConversionConformance.PDF_A_1b; private readonly PdfConversionConformance _pdfaConformanceLevel = PdfConversionConformance.PDF_A_1b;
public PDFMerger(LogConfig logConfig, string gdPictureLicenseKey) : base(logConfig) public PDFMerger(LicenseManager licenseManager, AnnotationManager annotationManager)
{ {
_licenseManager = new LicenseManager(); _licenseManager = licenseManager;
_licenseManager.RegisterKEY(gdPictureLicenseKey); _manager = annotationManager;
_manager = new AnnotationManager();
} }
public byte[] MergeDocuments(byte[] document, byte[] report) public byte[] MergeDocuments(byte[] document, byte[] report)
@@ -62,4 +58,4 @@ public class PDFMerger : BaseClass
return finalStream.ToArray(); return finalStream.ToArray();
} }
} }