refactor(PdfBurner): update BurnAnnotsToPDF to add form field
This commit is contained in:
parent
ef28bbaaf1
commit
8ad7c37261
@ -6,6 +6,7 @@ Imports DigitalData.Core.Abstraction.Application.Repository
|
|||||||
Imports DigitalData.Core.Abstractions
|
Imports DigitalData.Core.Abstractions
|
||||||
Imports DigitalData.Modules.Base
|
Imports DigitalData.Modules.Base
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
||||||
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
||||||
Imports EnvelopeGenerator.Domain.Entities
|
Imports EnvelopeGenerator.Domain.Entities
|
||||||
Imports EnvelopeGenerator.PdfEditor
|
Imports EnvelopeGenerator.PdfEditor
|
||||||
@ -52,6 +53,19 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Using doc As Pdf(Of MemoryStream, MemoryStream) = Pdf.FromMemory(pSourceBuffer)
|
Using doc As Pdf(Of MemoryStream, MemoryStream) = Pdf.FromMemory(pSourceBuffer)
|
||||||
Return doc.Background(elements).ExportStream().ToArray()
|
Return doc.Background(elements).ExportStream().ToArray()
|
||||||
End Using
|
End Using
|
||||||
|
|
||||||
|
For Each element In elements
|
||||||
|
|
||||||
|
Dim x = ToInches(element.Left)
|
||||||
|
Dim y = ToInches(element.Top)
|
||||||
|
|
||||||
|
For Each annot In element.Annotations
|
||||||
|
If annot.Type = AnnotationType.FormField Then
|
||||||
|
AddFormFieldValue(x, y, 100, 180, element.Page, annot.Value)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
|
||||||
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()
|
||||||
@ -151,6 +165,18 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub AddFormFieldValue(x As Double, y As Double, width As Double, height As Double, page As Integer, value As String)
|
||||||
|
Manager.SelectPage(page + 1)
|
||||||
|
' Add the text annotation
|
||||||
|
Dim ant = Manager.AddTextAnnot(x, y, width, height, value)
|
||||||
|
|
||||||
|
' Set the font properties
|
||||||
|
ant.FontName = _pdfBurnerParams.FontName
|
||||||
|
ant.FontSize = _pdfBurnerParams.FontSize
|
||||||
|
ant.FontStyle = _pdfBurnerParams.FontStyle
|
||||||
|
Manager.SaveAnnotationsToPage()
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub AddFormFieldValue(pAnnotation As Annotation, formFieldValue As FormFieldValue)
|
Private Sub AddFormFieldValue(pAnnotation As Annotation, formFieldValue As FormFieldValue)
|
||||||
Dim ffIndex As Integer = EGName.Index(pAnnotation.egName)
|
Dim ffIndex As Integer = EGName.Index(pAnnotation.egName)
|
||||||
|
|
||||||
@ -194,6 +220,7 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Public Const Image As String = "pspdfkit/image"
|
Public Const Image As String = "pspdfkit/image"
|
||||||
Public Const Ink As String = "pspdfkit/ink"
|
Public Const Ink As String = "pspdfkit/ink"
|
||||||
Public Const Widget As String = "pspdfkit/widget"
|
Public Const Widget As String = "pspdfkit/widget"
|
||||||
|
Public Const FormField As String = "pspdfkit/form-field-value"
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Friend Class AnnotationData
|
Friend Class AnnotationData
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user