From 763ac96f4e7d5db6d8d7a440cdcf0742fbb90002 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 5 Dec 2023 13:50:20 +0100 Subject: [PATCH] job --- .../Jobs/CertificateDocumentJob.vb | 9 +++++---- EnvelopeGenerator.Common/Jobs/PDFBurner.vb | 15 +++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/EnvelopeGenerator.Common/Jobs/CertificateDocumentJob.vb b/EnvelopeGenerator.Common/Jobs/CertificateDocumentJob.vb index 4bb1a105..9636c522 100644 --- a/EnvelopeGenerator.Common/Jobs/CertificateDocumentJob.vb +++ b/EnvelopeGenerator.Common/Jobs/CertificateDocumentJob.vb @@ -81,7 +81,8 @@ Namespace Jobs End If GenerateFinalPDF(oEnvelopeData) - Await GenerateReportPdf(oId) + Dim oReport As Byte() = Await GenerateReportPdf(oId) + MergeDocuments() Next @@ -139,13 +140,13 @@ Namespace Jobs Return True End Function - Private Async Function GenerateReportPdf(pEnvelopeId As Integer) As Task(Of Boolean) + Private Async Function GenerateReportPdf(pEnvelopeId As Integer) As Task(Of Byte()) Dim oSql As String = $"SELECT * FROM VWSIG_ENVELOPE_REPORT WHERE ENVELOPE_ID = {pEnvelopeId}" Dim oTable As DataTable = Database.GetDatatable(oSql) Dim oItems = GetReportSource(oTable) If oItems.Count = 0 Then - Return False + Return Nothing End If Dim oState As New State() With { @@ -158,7 +159,7 @@ Namespace Jobs Dim oCreator As New ReportCreator(oEnvelope) Dim oBuffer = Await oCreator.CreateReport(oItems) - Return True + Return oBuffer End Function Private Function GetReportSource(pDataTable As DataTable) As List(Of ReportItem) diff --git a/EnvelopeGenerator.Common/Jobs/PDFBurner.vb b/EnvelopeGenerator.Common/Jobs/PDFBurner.vb index 5c6411af..1252a71a 100644 --- a/EnvelopeGenerator.Common/Jobs/PDFBurner.vb +++ b/EnvelopeGenerator.Common/Jobs/PDFBurner.vb @@ -1,5 +1,5 @@ Imports System.Drawing -Imports DevExpress.Pdf +Imports System.IO Imports DigitalData.Modules.Base Imports DigitalData.Modules.Logging Imports GdPicture14 @@ -26,9 +26,9 @@ Namespace Jobs Manager = New AnnotationManager() End Sub - Public Function BurnInstantJSONAnnotationsToPDF(pSourcePath As String, pInstantJSONList As List(Of String), pDestinationPath As String) As Boolean - If Manager.InitFromFile(pSourcePath) <> GdPictureStatus.OK Then - Logger.Warn("Could not open file [{0}] for burning.", pSourcePath) + Public Function BurnInstantJSONAnnotationsToPDF(pSourceFilePath As String, pInstantJSONList As List(Of String), pDestinationDirectoryPath As String) As Boolean + If Manager.InitFromFile(pSourceFilePath) <> GdPictureStatus.OK Then + Logger.Warn("Could not open file [{0}] for burning.", pSourceFilePath) Return False End If @@ -39,14 +39,17 @@ Namespace Jobs End If Next + Dim oFileInfo As New FileInfo(pSourceFilePath) + Dim oDestinationFilePath As String = Path.Combine(pDestinationDirectoryPath, oFileInfo.Name) Try + Manager.BurnAnnotationsToPage(RemoveInitialAnnots:=True, VectorMode:=True) - Manager.SaveDocumentToPDF(pDestinationPath) + Manager.SaveDocumentToPDF(oDestinationFilePath) Manager.Close() Return True Catch ex As Exception - Logger.Warn("Could not burn and save annotations to file [{0}]!", pDestinationPath) + Logger.Warn("Could not burn and save annotations to file [{0}]!", oDestinationFilePath) Logger.Error(ex) Return False