refactor(PDFBurner): separate element annotation burning into dedicated method and simplify BurnAnnotsToPDF logic

This commit is contained in:
tekh 2025-10-24 12:21:04 +02:00
parent 02a7b706cf
commit a845b85a5c

View File

@ -44,12 +44,16 @@ Namespace Jobs.FinalizeDocument
.Include(Function(sig) sig.Annotations) _ .Include(Function(sig) sig.Annotations) _
.ToList() .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 ' Add background
Using doc As Pdf(Of MemoryStream, MemoryStream) = Pdf.FromMemory(pSourceBuffer) Using doc As Pdf(Of MemoryStream, MemoryStream) = Pdf.FromMemory(pSourceBuffer)
pSourceBuffer = doc.Background(elements).ExportStream().ToArray() Return doc.Background(elements).ExportStream().ToArray()
End Using End Using
Return BurnInstantJSONAnnotsToPDF(pSourceBuffer, pInstantJSONList)
End Function End Function
Public Function BurnInstantJSONAnnotsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String)) As Byte() Public Function BurnInstantJSONAnnotsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String)) As Byte()