diff --git a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs index 53a269d3..2b5dc2dd 100644 --- a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs +++ b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs @@ -17,7 +17,7 @@ namespace EnvelopeGenerator.Application.Pdf; /// /// /// -public record BurnPdfCommand(byte[] SourceBuffer, List InstantJSONList, int EnvelopeId) : IRequest; +public record BurnPdfCommand(byte[] Document, List InstantJSONList, int EnvelopeId) : IRequest; /// /// @@ -47,6 +47,27 @@ public class BurnPdfCommandHandler : IRequestHandler _logger = logger; } + + /// + /// + /// + /// + /// + /// + /// + public async Task Handle(BurnPdfCommand request, CancellationToken cancel) + { + // read the elements of envelope with their annotations + var elements = await _signRepo + .Where(sig => sig.Document.EnvelopeId == request.EnvelopeId) + .Include(sig => sig.Annotations) + .ToListAsync(cancel); + + return elements.Count > 0 + ? BurnElementAnnotsToPDF(request.Document, elements) + : BurnInstantJSONAnnotsToPDF(request.Document, request.InstantJSONList); + } + private byte[] BurnElementAnnotsToPDF(byte[] pSourceBuffer, List elements) { // Add background @@ -217,24 +238,4 @@ public class BurnPdfCommandHandler : IRequestHandler } } } - - /// - /// - /// - /// - /// - /// - /// - public async Task Handle(BurnPdfCommand request, CancellationToken cancel) - { - // read the elements of envelope with their annotations - var elements = await _signRepo - .Where(sig => sig.Document.EnvelopeId == request.EnvelopeId) - .Include(sig => sig.Annotations) - .ToListAsync(cancel); - - return elements.Count > 0 - ? BurnElementAnnotsToPDF(request.SourceBuffer, elements) - : BurnInstantJSONAnnotsToPDF(request.SourceBuffer, request.InstantJSONList); - } } \ No newline at end of file