From a845b85a5c0c1bc0de4e0ef35ef556dc6a855f26 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 24 Oct 2025 12:21:04 +0200 Subject: [PATCH] refactor(PDFBurner): separate element annotation burning into dedicated method and simplify BurnAnnotsToPDF logic --- .../Jobs/FinalizeDocument/PDFBurner.vb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb index 6a3d1aca..ccda7b83 100644 --- a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb +++ b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb @@ -44,12 +44,16 @@ Namespace Jobs.FinalizeDocument .Include(Function(sig) sig.Annotations) _ .ToList() + Return If(elements.Any(), + BurnElementAnnotsToPDF(pSourceBuffer, elements), + BurnInstantJSONAnnotsToPDF(pSourceBuffer, pInstantJSONList)) + End Function + + Public Function BurnElementAnnotsToPDF(pSourceBuffer As Byte(), elements As List(Of Signature)) As Byte() ' Add background Using doc As Pdf(Of MemoryStream, MemoryStream) = Pdf.FromMemory(pSourceBuffer) - pSourceBuffer = doc.Background(elements).ExportStream().ToArray() + Return doc.Background(elements).ExportStream().ToArray() End Using - - Return BurnInstantJSONAnnotsToPDF(pSourceBuffer, pInstantJSONList) End Function Public Function BurnInstantJSONAnnotsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String)) As Byte()