Refactor to use LicenseManagerFactory in PDF jobs

Replaced direct LicenseManager dependencies with LicenseManagerFactory in PDFBurner and PDFMerger classes. This change improves license management flexibility and encapsulation, allowing for better handling of license-related logic.
This commit is contained in:
2026-04-14 21:05:08 +02:00
parent 1f7eb5d4ea
commit a3f404b9ae
2 changed files with 6 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Infrastructure;
using EnvelopeGenerator.PdfEditor;
using EnvelopeGenerator.ServiceHost.Exceptions;
using EnvelopeGenerator.ServiceHost.Jobs;
using GdPicture14;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
@@ -11,16 +12,7 @@ using Newtonsoft.Json;
namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
//TODO: check if licence manager is needed as a dependency to
/// <summary>
///
/// </summary>
/// <param name="workerOptions"></param>
/// <param name="context2"></param>
/// <param name="logger2"></param>
/// <param name="licenseManager"></param>
/// <param name="annotationManager2"></param>
public class PDFBurner(IOptions<WorkerOptions> workerOptions, EGDbContext context, ILogger<PDFBurner> logger, LicenseManager licenseManager, AnnotationManager manager)
public class PDFBurner(IOptions<WorkerOptions> workerOptions, EGDbContext context, ILogger<PDFBurner> logger, LicenseManagerFactory licenseManagerFactory, AnnotationManager manager)
{
private readonly WorkerOptions.PDFBurnerOptions _options = workerOptions.Value.PdfBurner;

View File

@@ -1,4 +1,5 @@
using EnvelopeGenerator.ServiceHost.Exceptions;
using EnvelopeGenerator.ServiceHost.Jobs;
using GdPicture14;
using Microsoft.Extensions.Options;
@@ -7,16 +8,16 @@ namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
public class PDFMerger
{
private readonly AnnotationManager _manager;
private readonly LicenseManager _licenseManager;
private readonly LicenseManagerFactory _licenseManagerFactory;
private const bool AllowRasterization = true;
private const bool AllowVectorization = true;
private readonly PdfConversionConformance _pdfaConformanceLevel = PdfConversionConformance.PDF_A_1b;
public PDFMerger(LicenseManager licenseManager, AnnotationManager annotationManager)
public PDFMerger(LicenseManagerFactory licenseManagerFactory, AnnotationManager annotationManager)
{
_licenseManager = licenseManager;
_licenseManagerFactory = licenseManagerFactory;
_manager = annotationManager;
}