Compare commits
13 Commits
0107602a84
...
ef28bbaaf1
| Author | SHA1 | Date | |
|---|---|---|---|
| ef28bbaaf1 | |||
| 258de6244c | |||
| a845b85a5c | |||
| 02a7b706cf | |||
| 7912469709 | |||
| 75d975223e | |||
| c456d67d03 | |||
| 241e59fc7e | |||
| f0d101bb23 | |||
| 8db5afae40 | |||
| b62cca5961 | |||
| 0e7b120ded | |||
| d8cbdb0c65 |
@@ -35,7 +35,7 @@ public class MappingProfile : Profile
|
|||||||
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
||||||
CreateMap<Domain.Entities.Receiver, ReceiverDto>();
|
CreateMap<Domain.Entities.Receiver, ReceiverDto>();
|
||||||
CreateMap<Domain.Entities.EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
|
CreateMap<Domain.Entities.EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
|
||||||
CreateMap<Annotation, AnnotationDto>();
|
CreateMap<ElementAnnotation, AnnotationDto>();
|
||||||
|
|
||||||
// DTO to Entity mappings
|
// DTO to Entity mappings
|
||||||
CreateMap<ConfigDto, Config>();
|
CreateMap<ConfigDto, Config>();
|
||||||
@@ -51,7 +51,7 @@ public class MappingProfile : Profile
|
|||||||
CreateMap<ReceiverDto, Domain.Entities.Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
|
CreateMap<ReceiverDto, Domain.Entities.Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
|
||||||
CreateMap<EnvelopeReceiverReadOnlyCreateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
CreateMap<EnvelopeReceiverReadOnlyCreateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||||
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||||
CreateMap<AnnotationCreateDto, Annotation>()
|
CreateMap<AnnotationCreateDto, ElementAnnotation>()
|
||||||
.ForMember(dest => dest.AddedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow));
|
.ForMember(dest => dest.AddedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow));
|
||||||
|
|
||||||
// Messaging mappings
|
// Messaging mappings
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ public class AnnotationHandler : INotificationHandler<DocSignedNotification>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IRepository<Annotation> _repo;
|
private readonly IRepository<ElementAnnotation> _repo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="repository"></param>
|
/// <param name="repository"></param>
|
||||||
public AnnotationHandler(IRepository<Annotation> repository)
|
public AnnotationHandler(IRepository<ElementAnnotation> repository)
|
||||||
{
|
{
|
||||||
_repo = repository;
|
_repo = repository;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ namespace EnvelopeGenerator.Application.Common.Notifications.RemoveSignature.Han
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RemoveAnnotationHandler : INotificationHandler<RemoveSignatureNotification>
|
public class RemoveAnnotationHandler : INotificationHandler<RemoveSignatureNotification>
|
||||||
{
|
{
|
||||||
private readonly IRepository<Annotation> _repo;
|
private readonly IRepository<ElementAnnotation> _repo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="repository"></param>
|
/// <param name="repository"></param>
|
||||||
public RemoveAnnotationHandler(IRepository<Annotation> repository)
|
public RemoveAnnotationHandler(IRepository<ElementAnnotation> repository)
|
||||||
{
|
{
|
||||||
_repo = repository;
|
_repo = repository;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.1.66" />
|
<PackageReference Include="Dapper" Version="2.1.66" />
|
||||||
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.3.7" />
|
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.4.0" />
|
||||||
<PackageReference Include="DigitalData.Core.Application" Version="3.4.0" />
|
<PackageReference Include="DigitalData.Core.Application" Version="3.4.0" />
|
||||||
<PackageReference Include="DigitalData.Core.Client" Version="2.1.0" />
|
<PackageReference Include="DigitalData.Core.Client" Version="2.1.0" />
|
||||||
<PackageReference Include="DigitalData.Core.Exceptions" Version="1.1.0" />
|
<PackageReference Include="DigitalData.Core.Exceptions" Version="1.1.0" />
|
||||||
|
|||||||
@@ -70,11 +70,11 @@
|
|||||||
<Reference Include="DigitalData.Controls.DocumentViewer, Version=1.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Controls.DocumentViewer, Version=1.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DigitalData.Controls.DocumentViewer.1.9.8\lib\net462\DigitalData.Controls.DocumentViewer.dll</HintPath>
|
<HintPath>..\packages\DigitalData.Controls.DocumentViewer.1.9.8\lib\net462\DigitalData.Controls.DocumentViewer.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Core.Abstraction.Application, Version=1.3.7.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Core.Abstraction.Application, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DigitalData.Core.Abstraction.Application.1.3.7\lib\net462\DigitalData.Core.Abstraction.Application.dll</HintPath>
|
<HintPath>..\packages\DigitalData.Core.Abstraction.Application.1.4.0\lib\net462\DigitalData.Core.Abstraction.Application.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Core.Abstractions, Version=4.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Core.Abstractions, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DigitalData.Core.Abstractions.4.1.1\lib\net462\DigitalData.Core.Abstractions.dll</HintPath>
|
<HintPath>..\packages\DigitalData.Core.Abstractions.4.2.0\lib\net462\DigitalData.Core.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DigitalData.Modules.Base.1.3.8\lib\net462\DigitalData.Modules.Base.dll</HintPath>
|
<HintPath>..\packages\DigitalData.Modules.Base.1.3.8\lib\net462\DigitalData.Modules.Base.dll</HintPath>
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ Imports EnvelopeGenerator.CommonServices.Jobs
|
|||||||
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument
|
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument
|
||||||
Imports GdPicture14
|
Imports GdPicture14
|
||||||
Imports Newtonsoft.Json.Linq
|
Imports Newtonsoft.Json.Linq
|
||||||
Imports DigitalData.Core.Abstraction.Application
|
|
||||||
Imports EnvelopeGenerator.Infrastructure
|
Imports EnvelopeGenerator.Infrastructure
|
||||||
Imports Microsoft.EntityFrameworkCore
|
Imports Microsoft.EntityFrameworkCore
|
||||||
Imports System.Text
|
Imports System.Text
|
||||||
|
Imports DigitalData.Core.Abstractions
|
||||||
|
|
||||||
Public Class frmFinalizePDF
|
Public Class frmFinalizePDF
|
||||||
Private Const CONNECTIONSTRING = "Server=sDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=+bk8oAbbQP1AzoHtvZUbd+Mbok2f8Fl4miEx1qssJ5yEaEWoQJ9prg4L14fURpPnqi1WMNs9fE4=;"
|
Private Const CONNECTIONSTRING = "Server=sDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=+bk8oAbbQP1AzoHtvZUbd+Mbok2f8Fl4miEx1qssJ5yEaEWoQJ9prg4L14fURpPnqi1WMNs9fE4=;"
|
||||||
@@ -24,7 +24,10 @@ Public Class frmFinalizePDF
|
|||||||
|
|
||||||
Private Sub frmFinalizePDF_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub frmFinalizePDF_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath)
|
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath)
|
||||||
Database = New MSSQLServer(LogConfig, MSSQLServer.DecryptConnectionString(CONNECTIONSTRING))
|
|
||||||
|
Dim dCnnStr As String = MSSQLServer.DecryptConnectionString(CONNECTIONSTRING)
|
||||||
|
|
||||||
|
Database = New MSSQLServer(LogConfig, dCnnStr)
|
||||||
|
|
||||||
#Disable Warning BC40000 ' Type or member is obsolete
|
#Disable Warning BC40000 ' Type or member is obsolete
|
||||||
Factory.Shared.AddEnvelopeGeneratorInfrastructureServices(
|
Factory.Shared.AddEnvelopeGeneratorInfrastructureServices(
|
||||||
@@ -40,7 +43,7 @@ Public Class frmFinalizePDF
|
|||||||
End Sub)
|
End Sub)
|
||||||
opt.AddDbContext(
|
opt.AddDbContext(
|
||||||
Sub(options)
|
Sub(options)
|
||||||
options.UseSqlServer(CONNECTIONSTRING) _
|
options.UseSqlServer(dCnnStr) _
|
||||||
.EnableSensitiveDataLogging() _
|
.EnableSensitiveDataLogging() _
|
||||||
.EnableDetailedErrors()
|
.EnableDetailedErrors()
|
||||||
End Sub)
|
End Sub)
|
||||||
@@ -96,8 +99,9 @@ Public Class frmFinalizePDF
|
|||||||
Select(Function(r As DataRow) r.Item("VALUE").ToString()).
|
Select(Function(r As DataRow) r.Item("VALUE").ToString()).
|
||||||
ToList()
|
ToList()
|
||||||
|
|
||||||
Dim oBuffer As Byte() = ReadEnvelope(CInt(txtEnvelope.Text))
|
Dim envelopeId As Integer = CInt(txtEnvelope.Text)
|
||||||
Dim oNewBuffer = PDFBurner.BurnInstantJSONAnnotationsToPDF(oBuffer, oJsonList)
|
Dim oBuffer As Byte() = ReadEnvelope(envelopeId)
|
||||||
|
Dim oNewBuffer = PDFBurner.BurnAnnotsToPDF(oBuffer, oJsonList, envelopeId)
|
||||||
Dim desktopPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
|
Dim desktopPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
|
||||||
Dim oNewPath = Path.Combine(desktopPath, $"E{txtEnvelope.Text}R{txtReceiver.Text}.burned.pdf")
|
Dim oNewPath = Path.Combine(desktopPath, $"E{txtEnvelope.Text}R{txtReceiver.Text}.burned.pdf")
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<package id="AutoMapper" version="10.1.1" targetFramework="net462" />
|
<package id="AutoMapper" version="10.1.1" targetFramework="net462" />
|
||||||
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
|
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Controls.DocumentViewer" version="1.9.8" targetFramework="net462" />
|
<package id="DigitalData.Controls.DocumentViewer" version="1.9.8" targetFramework="net462" />
|
||||||
<package id="DigitalData.Core.Abstraction.Application" version="1.3.7" targetFramework="net462" />
|
<package id="DigitalData.Core.Abstraction.Application" version="1.4.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Core.Abstractions" version="4.1.1" targetFramework="net462" />
|
<package id="DigitalData.Core.Abstractions" version="4.2.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Modules.Base" version="1.3.8" targetFramework="net462" />
|
<package id="DigitalData.Modules.Base" version="1.3.8" targetFramework="net462" />
|
||||||
<package id="DigitalData.Modules.Config" version="1.3.0" targetFramework="net462" />
|
<package id="DigitalData.Modules.Config" version="1.3.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Modules.Database" version="2.3.5.4" targetFramework="net462" />
|
<package id="DigitalData.Modules.Database" version="2.3.5.4" targetFramework="net462" />
|
||||||
|
|||||||
@@ -72,11 +72,11 @@
|
|||||||
<Reference Include="DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
<Reference Include="DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||||
<Reference Include="DevExpress.XtraGauges.v21.2.Core, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
<Reference Include="DevExpress.XtraGauges.v21.2.Core, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||||
<Reference Include="DevExpress.XtraReports.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
<Reference Include="DevExpress.XtraReports.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||||
<Reference Include="DigitalData.Core.Abstraction.Application, Version=1.3.7.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Core.Abstraction.Application, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DigitalData.Core.Abstraction.Application.1.3.7\lib\net462\DigitalData.Core.Abstraction.Application.dll</HintPath>
|
<HintPath>..\packages\DigitalData.Core.Abstraction.Application.1.4.0\lib\net462\DigitalData.Core.Abstraction.Application.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Core.Abstractions, Version=4.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Core.Abstractions, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DigitalData.Core.Abstractions.4.1.1\lib\net462\DigitalData.Core.Abstractions.dll</HintPath>
|
<HintPath>..\packages\DigitalData.Core.Abstractions.4.2.0\lib\net462\DigitalData.Core.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DigitalData.Modules.Base.1.3.8\lib\net462\DigitalData.Modules.Base.dll</HintPath>
|
<HintPath>..\packages\DigitalData.Modules.Base.1.3.8\lib\net462\DigitalData.Modules.Base.dll</HintPath>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Imports EnvelopeGenerator.Domain.Entities
|
|||||||
Imports DigitalData.Core.Abstraction.Application
|
Imports DigitalData.Core.Abstraction.Application
|
||||||
Imports EnvelopeGenerator.Infrastructure
|
Imports EnvelopeGenerator.Infrastructure
|
||||||
Imports Microsoft.EntityFrameworkCore
|
Imports Microsoft.EntityFrameworkCore
|
||||||
|
Imports DigitalData.Core.Abstractions
|
||||||
|
|
||||||
Namespace Jobs
|
Namespace Jobs
|
||||||
Public Class FinalizeDocumentJob
|
Public Class FinalizeDocumentJob
|
||||||
@@ -403,7 +404,6 @@ Namespace Jobs
|
|||||||
ParentFolderUID = pEnvelopeData.EnvelopeUUID
|
ParentFolderUID = pEnvelopeData.EnvelopeUUID
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Logger.Info("ParentFolderUID: [{0}]", ParentFolderUID)
|
Logger.Info("ParentFolderUID: [{0}]", ParentFolderUID)
|
||||||
Dim oInputDocumentBuffer As Byte()
|
Dim oInputDocumentBuffer As Byte()
|
||||||
If Not IsNothing(pEnvelopeData.DocAsByte) Then
|
If Not IsNothing(pEnvelopeData.DocAsByte) Then
|
||||||
@@ -416,7 +416,7 @@ Namespace Jobs
|
|||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return PDFBurner.BurnInstantJSONAnnotationsToPDF(oInputDocumentBuffer, oAnnotations)
|
Return PDFBurner.BurnAnnotsToPDF(oInputDocumentBuffer, oAnnotations, pEnvelopeData.EnvelopeId)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetEnvelopeData(pEnvelopeId As Integer) As EnvelopeData
|
Private Function GetEnvelopeData(pEnvelopeId As Integer) As EnvelopeData
|
||||||
|
|||||||
@@ -2,10 +2,15 @@
|
|||||||
Imports System.Drawing
|
Imports System.Drawing
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports DevExpress.DataProcessing
|
Imports DevExpress.DataProcessing
|
||||||
|
Imports DigitalData.Core.Abstraction.Application.Repository
|
||||||
|
Imports DigitalData.Core.Abstractions
|
||||||
Imports DigitalData.Modules.Base
|
Imports DigitalData.Modules.Base
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
||||||
|
Imports EnvelopeGenerator.Domain.Entities
|
||||||
|
Imports EnvelopeGenerator.PdfEditor
|
||||||
Imports GdPicture14
|
Imports GdPicture14
|
||||||
|
Imports Microsoft.EntityFrameworkCore
|
||||||
Imports Newtonsoft.Json
|
Imports Newtonsoft.Json
|
||||||
|
|
||||||
Namespace Jobs.FinalizeDocument
|
Namespace Jobs.FinalizeDocument
|
||||||
@@ -15,9 +20,6 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Private ReadOnly Manager As AnnotationManager
|
Private ReadOnly Manager As AnnotationManager
|
||||||
Private ReadOnly LicenseManager As LicenseManager
|
Private ReadOnly LicenseManager As LicenseManager
|
||||||
|
|
||||||
Private Const ANNOTATION_TYPE_IMAGE = "pspdfkit/image"
|
|
||||||
Private Const ANNOTATION_TYPE_INK = "pspdfkit/ink"
|
|
||||||
Private Const ANNOTATION_TYPE_WIDGET = "pspdfkit/widget"
|
|
||||||
Private Property _pdfBurnerParams As PDFBurnerParams
|
Private Property _pdfBurnerParams As PDFBurnerParams
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pGDPictureLicenseKey As String, pdfBurnerParams As PDFBurnerParams)
|
Public Sub New(pLogConfig As LogConfig, pGDPictureLicenseKey As String, pdfBurnerParams As PDFBurnerParams)
|
||||||
@@ -31,7 +33,28 @@ Namespace Jobs.FinalizeDocument
|
|||||||
_pdfBurnerParams = pdfBurnerParams
|
_pdfBurnerParams = pdfBurnerParams
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function BurnInstantJSONAnnotationsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String)) As Byte()
|
#Region "Burn PDF"
|
||||||
|
Public Function BurnAnnotsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String), envelopeId As Integer) As Byte()
|
||||||
|
'read the elements of envelope with their annotations
|
||||||
|
Dim sigRepo = Factory.Shared.Repository(Of Signature)()
|
||||||
|
Dim elements = sigRepo _
|
||||||
|
.Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _
|
||||||
|
.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)
|
||||||
|
Return doc.Background(elements).ExportStream().ToArray()
|
||||||
|
End Using
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function BurnInstantJSONAnnotsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String)) As Byte()
|
||||||
Dim oResult As GdPictureStatus
|
Dim oResult As GdPictureStatus
|
||||||
Using oSourceStream As New MemoryStream(pSourceBuffer)
|
Using oSourceStream As New MemoryStream(pSourceBuffer)
|
||||||
' Open PDF
|
' Open PDF
|
||||||
@@ -68,7 +91,9 @@ Namespace Jobs.FinalizeDocument
|
|||||||
End Using
|
End Using
|
||||||
End Using
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Add Value"
|
||||||
Private Sub AddInstantJSONAnnotationToPDF(pInstantJSON As String)
|
Private Sub AddInstantJSONAnnotationToPDF(pInstantJSON As String)
|
||||||
Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON)
|
Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON)
|
||||||
|
|
||||||
@@ -78,16 +103,13 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
|
Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
|
||||||
|
|
||||||
Select Case oAnnotation.type
|
Select Case oAnnotation.type
|
||||||
Case ANNOTATION_TYPE_IMAGE
|
Case AnnotationType.Image
|
||||||
|
|
||||||
AddImageAnnotation(oAnnotation, oAnnotationData.attachments)
|
AddImageAnnotation(oAnnotation, oAnnotationData.attachments)
|
||||||
Exit Select
|
Exit Select
|
||||||
|
Case AnnotationType.Ink
|
||||||
Case ANNOTATION_TYPE_INK
|
|
||||||
AddInkAnnotation(oAnnotation)
|
AddInkAnnotation(oAnnotation)
|
||||||
Exit Select
|
Exit Select
|
||||||
|
Case AnnotationType.Widget
|
||||||
Case ANNOTATION_TYPE_WIDGET
|
|
||||||
'Add form field values
|
'Add form field values
|
||||||
Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id)
|
Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id)
|
||||||
If formFieldValue IsNot Nothing AndAlso Not _pdfBurnerParams.IgnoredLabels.Contains(formFieldValue.value) Then
|
If formFieldValue IsNot Nothing AndAlso Not _pdfBurnerParams.IgnoredLabels.Contains(formFieldValue.value) Then
|
||||||
@@ -150,7 +172,9 @@ Namespace Jobs.FinalizeDocument
|
|||||||
ant.FontStyle = _pdfBurnerParams.FontStyle
|
ant.FontStyle = _pdfBurnerParams.FontStyle
|
||||||
Manager.SaveAnnotationsToPage()
|
Manager.SaveAnnotationsToPage()
|
||||||
End Sub
|
End Sub
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Helpers"
|
||||||
Private Function ToPointF(pPoints As List(Of Single)) As PointF
|
Private Function ToPointF(pPoints As List(Of Single)) As PointF
|
||||||
Dim oPoints = pPoints.Select(AddressOf ToInches).ToList()
|
Dim oPoints = pPoints.Select(AddressOf ToInches).ToList()
|
||||||
Return New PointF(oPoints.Item(0), oPoints.Item(1))
|
Return New PointF(oPoints.Item(0), oPoints.Item(1))
|
||||||
@@ -163,6 +187,14 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Private Function ToInches(pValue As Single) As Single
|
Private Function ToInches(pValue As Single) As Single
|
||||||
Return pValue / 72
|
Return pValue / 72
|
||||||
End Function
|
End Function
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Model"
|
||||||
|
Friend Class AnnotationType
|
||||||
|
Public Const Image As String = "pspdfkit/image"
|
||||||
|
Public Const Ink As String = "pspdfkit/ink"
|
||||||
|
Public Const Widget As String = "pspdfkit/widget"
|
||||||
|
End Class
|
||||||
|
|
||||||
Friend Class AnnotationData
|
Friend Class AnnotationData
|
||||||
Public Property annotations As List(Of Annotation)
|
Public Property annotations As List(Of Annotation)
|
||||||
@@ -293,5 +325,6 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Public Property name As String
|
Public Property name As String
|
||||||
Public Property value As String
|
Public Property value As String
|
||||||
End Class
|
End Class
|
||||||
|
#End Region
|
||||||
End Class
|
End Class
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="AutoMapper" version="10.1.1" targetFramework="net462" />
|
<package id="AutoMapper" version="10.1.1" targetFramework="net462" />
|
||||||
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
|
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Core.Abstraction.Application" version="1.3.7" targetFramework="net462" />
|
<package id="DigitalData.Core.Abstraction.Application" version="1.4.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Core.Abstractions" version="4.1.1" targetFramework="net462" />
|
<package id="DigitalData.Core.Abstractions" version="4.2.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Modules.Base" version="1.3.8" targetFramework="net462" />
|
<package id="DigitalData.Modules.Base" version="1.3.8" targetFramework="net462" />
|
||||||
<package id="DigitalData.Modules.Config" version="1.3.0" targetFramework="net462" />
|
<package id="DigitalData.Modules.Config" version="1.3.0" targetFramework="net462" />
|
||||||
<package id="DigitalData.Modules.Database" version="2.3.5.4" targetFramework="net462" />
|
<package id="DigitalData.Modules.Database" version="2.3.5.4" targetFramework="net462" />
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace EnvelopeGenerator.Domain.Entities
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT_ANNOTATION")]
|
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT_ANNOTATION")]
|
||||||
public class Annotation
|
public class ElementAnnotation
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
@@ -114,7 +114,7 @@ public class Signature : ISignature, IHasReceiver
|
|||||||
#endif
|
#endif
|
||||||
Receiver { get; set; }
|
Receiver { get; set; }
|
||||||
|
|
||||||
public virtual IEnumerable<Annotation>
|
public virtual IEnumerable<ElementAnnotation>
|
||||||
#if NET
|
#if NET
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction.Attributes" Version="1.0.0" />
|
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction.Attributes" Version="1.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="UserManager.Domain" Version="3.2.3" />
|
<PackageReference Include="UserManager.Domain" Version="3.2.3" />
|
||||||
<PackageReference Include="DigitalData.Core.Abstractions" Version="4.1.1" />
|
<PackageReference Include="DigitalData.Core.Abstractions" Version="4.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.1.66" />
|
<PackageReference Include="Dapper" Version="2.1.66" />
|
||||||
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.3.7" />
|
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.4.0" />
|
||||||
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.4.5" />
|
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.4.5" />
|
||||||
<PackageReference Include="QuestPDF" Version="2025.7.1" />
|
<PackageReference Include="QuestPDF" Version="2025.7.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
using iText.Kernel.Pdf.Canvas;
|
using iText.Kernel.Pdf.Canvas;
|
||||||
using EnvelopeGenerator.Domain.Interfaces;
|
using EnvelopeGenerator.Domain.Interfaces;
|
||||||
using iText.Kernel.Colors;
|
using iText.Kernel.Colors;
|
||||||
using iText.Kernel.Geom;
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#endif
|
#endif
|
||||||
@@ -19,6 +17,15 @@ namespace EnvelopeGenerator.PdfEditor
|
|||||||
{
|
{
|
||||||
return new Pdf<MemoryStream, MemoryStream>(new MemoryStream(documentBytes), new MemoryStream());
|
return new Pdf<MemoryStream, MemoryStream>(new MemoryStream(documentBytes), new MemoryStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Pdf<MemoryStream, MemoryStream> FromMemory(MemoryStream stream, MemoryStream
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
outputStream = null)
|
||||||
|
{
|
||||||
|
return new Pdf<MemoryStream, MemoryStream>(stream, outputStream ?? new MemoryStream(), disposeInputStream: false, disposeOutputStream: outputStream is null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Pdf<TInputStream, TOutputStream> : IDisposable, IAsyncDisposable
|
public class Pdf<TInputStream, TOutputStream> : IDisposable, IAsyncDisposable
|
||||||
@@ -31,13 +38,18 @@ namespace EnvelopeGenerator.PdfEditor
|
|||||||
private readonly PdfReader _reader;
|
private readonly PdfReader _reader;
|
||||||
private readonly PdfWriter _writer;
|
private readonly PdfWriter _writer;
|
||||||
|
|
||||||
public Pdf(TInputStream inputStream, TOutputStream outputStream)
|
private readonly bool _disposeInputStream;
|
||||||
|
private readonly bool _disposeOutputStream;
|
||||||
|
|
||||||
|
public Pdf(TInputStream inputStream, TOutputStream outputStream, bool disposeInputStream = true, bool disposeOutputStream = true)
|
||||||
{
|
{
|
||||||
_inputStream = inputStream;
|
_inputStream = inputStream;
|
||||||
_outputStream = outputStream;
|
_outputStream = outputStream;
|
||||||
_reader = new PdfReader(inputStream);
|
_reader = new PdfReader(inputStream);
|
||||||
_writer = new PdfWriter(outputStream);
|
_writer = new PdfWriter(outputStream);
|
||||||
_doc = new PdfDocument(_reader, _writer);
|
_doc = new PdfDocument(_reader, _writer);
|
||||||
|
_disposeInputStream = disposeInputStream;
|
||||||
|
_disposeOutputStream = disposeOutputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -149,16 +161,16 @@ namespace EnvelopeGenerator.PdfEditor
|
|||||||
{
|
{
|
||||||
// Managed resources
|
// Managed resources
|
||||||
_doc?.Close();
|
_doc?.Close();
|
||||||
_inputStream?.Dispose();
|
if (_disposeInputStream) _inputStream?.Dispose();
|
||||||
_outputStream?.Dispose();
|
if(_disposeOutputStream) _outputStream?.Dispose();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// When called by the finalizer, clean up only unmanaged resources
|
// When called by the finalizer, clean up only unmanaged resources
|
||||||
// Unmanaged resources such as PdfDocument, PdfReader, and PdfWriter are already IDisposable; we close them here
|
// Unmanaged resources such as PdfDocument, PdfReader, and PdfWriter are already IDisposable; we close them here
|
||||||
try { _doc?.Close(); } catch { }
|
try { _doc?.Close(); } catch { }
|
||||||
try { _inputStream?.Dispose(); } catch { }
|
try { if(_disposeInputStream) _inputStream?.Dispose(); } catch { }
|
||||||
try { _outputStream?.Dispose(); } catch { }
|
try { if (_disposeOutputStream) _outputStream?.Dispose(); } catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
@@ -170,15 +182,21 @@ namespace EnvelopeGenerator.PdfEditor
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_doc?.Close();
|
_doc?.Close();
|
||||||
if (_inputStream is IAsyncDisposable asyncInput)
|
if (_disposeInputStream)
|
||||||
await asyncInput.DisposeAsync();
|
{
|
||||||
else
|
if (_inputStream is IAsyncDisposable asyncInput)
|
||||||
_inputStream.Dispose();
|
await asyncInput.DisposeAsync();
|
||||||
|
else
|
||||||
|
_inputStream.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
if (_outputStream is IAsyncDisposable asyncOutput)
|
if (_disposeOutputStream)
|
||||||
await asyncOutput.DisposeAsync();
|
{
|
||||||
else
|
if (_outputStream is IAsyncDisposable asyncOutput)
|
||||||
_outputStream?.Dispose();
|
await asyncOutput.DisposeAsync();
|
||||||
|
else
|
||||||
|
_outputStream?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Bogus" Version="35.6.3" />
|
<PackageReference Include="Bogus" Version="35.6.3" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||||
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.3.7" />
|
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.4.0" />
|
||||||
<PackageReference Include="DigitalData.Core.Abstractions" Version="4.1.1" />
|
<PackageReference Include="DigitalData.Core.Abstractions" Version="4.2.0" />
|
||||||
<PackageReference Include="DigitalData.Core.API" Version="2.2.1" />
|
<PackageReference Include="DigitalData.Core.API" Version="2.2.1" />
|
||||||
<PackageReference Include="DigitalData.Core.Application" Version="3.4.0" />
|
<PackageReference Include="DigitalData.Core.Application" Version="3.4.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
|
||||||
|
|||||||
Reference in New Issue
Block a user