From bf5faf53bd306a41feb7b0affb8dfe5543187736 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 11:37:46 +0200 Subject: [PATCH 1/4] =?UTF-8?q?refactor(frmFinalizePDF):=20Aktualisieren?= =?UTF-8?q?=20von=20Button1=5FClick=20zum=20=C3=96ffnen=20von=20PDF=20nach?= =?UTF-8?q?=20dem=20Brennvorgang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.BBTests/frmFinalizePDF.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EnvelopeGenerator.BBTests/frmFinalizePDF.vb b/EnvelopeGenerator.BBTests/frmFinalizePDF.vb index e6512651..a0ef4043 100644 --- a/EnvelopeGenerator.BBTests/frmFinalizePDF.vb +++ b/EnvelopeGenerator.BBTests/frmFinalizePDF.vb @@ -77,6 +77,8 @@ Public Class frmFinalizePDF Dim oNewPath = Path.Combine(desktopPath, $"E{txtEnvelope.Text}R{txtReceiver.Text}.burned.pdf") File.WriteAllBytes(oNewPath, oNewBuffer) + + Process.Start(oNewPath) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical) End Try From 7f0131fc2d24e497da9c304178c39b619f0077ec Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 11:44:29 +0200 Subject: [PATCH 2/4] =?UTF-8?q?refactor(FinalizeDocumentJob):=20Update=20f?= =?UTF-8?q?=C3=BCr=20detaillierte=20Protokollierung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Jobs/FinalizeDocument/FinalizeDocumentJob.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb index 5287e5ac..00da17fd 100644 --- a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb +++ b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb @@ -170,7 +170,7 @@ Namespace Jobs Throw New ApplicationException("Envelope could not be finalized") End If Catch ex As Exception - Logger.Warn($"Unhandled exception while working envelope [{oId}] - [{ex.Message}]") + Logger.Warn(ex, $"Unhandled exception while working envelope [{oId}]") End Try From ac0ae10fabaa09e887adcb7e155ee238c769b019 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 11:47:11 +0200 Subject: [PATCH 3/4] =?UTF-8?q?unn=C3=B6tige=20Protokollierung=20entfernt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Jobs/FinalizeDocument/FinalizeDocumentJob.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb index 00da17fd..0492359d 100644 --- a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb +++ b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb @@ -378,7 +378,6 @@ Namespace Jobs Try oInputDocumentBuffer = File.ReadAllBytes(oInputPath) Catch ex As Exception - Logger.Error(ex) Throw New BurnAnnotationException("Source document could not be read from disk!", ex) End Try End If From 276adda516670cbac158ec204ad6ac43f63d08ba Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 11:48:54 +0200 Subject: [PATCH 4/4] =?UTF-8?q?unn=C3=B6tige=20Protokollierung=20entfernt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinalizeDocument/FinalizeDocumentJob.vb | 1 - .../Jobs/FinalizeDocument/PDFBurner.vb | 59 ++++++++----------- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb index 0492359d..a0b33b78 100644 --- a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb +++ b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb @@ -382,7 +382,6 @@ Namespace Jobs End Try End If - Return PDFBurner.BurnInstantJSONAnnotationsToPDF(oInputDocumentBuffer, oAnnotations) End Function diff --git a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb index c7010dc1..ea4626cd 100644 --- a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb +++ b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb @@ -31,45 +31,38 @@ Namespace Jobs.FinalizeDocument Public Function BurnInstantJSONAnnotationsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String)) As Byte() Dim oResult As GdPictureStatus - - Try - Using oSourceStream As New MemoryStream(pSourceBuffer) - ' Open PDF - oResult = Manager.InitFromStream(oSourceStream) - If oResult <> GdPictureStatus.OK Then - Throw New BurnAnnotationException($"Could not open document for burning: [{oResult}]") + Using oSourceStream As New MemoryStream(pSourceBuffer) + ' Open PDF + oResult = Manager.InitFromStream(oSourceStream) + If oResult <> GdPictureStatus.OK Then + Throw New BurnAnnotationException($"Could not open document for burning: [{oResult}]") + End If + + ' Add annotation to PDF + For Each oJSON In pInstantJSONList + If AddInstantJSONAnnotationToPDF(oJSON) = False Then + Logger.Warn($"Error in AddInstantJSONAnnotationToPDF - oJson: ") + Logger.Warn(oJSON) + Throw New BurnAnnotationException($"Adding Annotation failed") End If - - ' Add annotation to PDF - For Each oJSON In pInstantJSONList - If AddInstantJSONAnnotationToPDF(oJSON) = False Then - Logger.Warn($"Error in AddInstantJSONAnnotationToPDF - oJson: ") - Logger.Warn(oJSON) - Throw New BurnAnnotationException($"Adding Annotation failed") - End If - Next - oResult = Manager.BurnAnnotationsToPage(RemoveInitialAnnots:=True, VectorMode:=True) + Next + oResult = Manager.BurnAnnotationsToPage(RemoveInitialAnnots:=True, VectorMode:=True) + If oResult <> GdPictureStatus.OK Then + Throw New BurnAnnotationException($"Could not burn annotations to file: [{oResult}]") + End If + + 'Save PDF + Using oNewStream As New MemoryStream() + oResult = Manager.SaveDocumentToPDF(oNewStream) If oResult <> GdPictureStatus.OK Then - Throw New BurnAnnotationException($"Could not burn annotations to file: [{oResult}]") + Throw New BurnAnnotationException($"Could not save document to stream: [{oResult}]") End If - 'Save PDF - Using oNewStream As New MemoryStream() - oResult = Manager.SaveDocumentToPDF(oNewStream) - If oResult <> GdPictureStatus.OK Then - Throw New BurnAnnotationException($"Could not save document to stream: [{oResult}]") - End If + Manager.Close() - Manager.Close() - - Return oNewStream.ToArray() - End Using + Return oNewStream.ToArray() End Using - Catch ex As Exception - Logger.Error(ex) - - Return Nothing - End Try + End Using End Function Private Function AddInstantJSONAnnotationToPDF(pInstantJSON As String) As Boolean