Funktion zur Aufhebung der Formfelder im Signiervorgang - Class EnvelopeEditorController, Class FlattenFormFields

This commit is contained in:
OlgunR 2025-04-24 11:42:50 +02:00
parent 3c5f5cb5f5
commit ae31b1da0f
3 changed files with 34 additions and 1 deletions

View File

@ -166,7 +166,7 @@ Public Class EnvelopeEditorController
DocumentRotationChanged() DocumentRotationChanged()
Logger.Info("PageRotation has been reseted to 0.") Logger.Info("PageRotation has been reseted to 0.")
End If End If
GdPicturePDF.FlattenFormFields() oFixedPath = FlattenFormFields.FlattenFormFields(oFixedPath)
Dim oFileInfo = New FileInfo(oFixedPath) Dim oFileInfo = New FileInfo(oFixedPath)
Dim oTempFiles As New TempFiles(State.LogConfig) Dim oTempFiles As New TempFiles(State.LogConfig)
Dim oTempFilePath = Path.Combine(oTempFiles._TempPath, Guid.NewGuid().ToString + oFileInfo.Extension) Dim oTempFilePath = Path.Combine(oTempFiles._TempPath, Guid.NewGuid().ToString + oFileInfo.Extension)

View File

@ -369,6 +369,7 @@
</Compile> </Compile>
<Compile Include="Helper\Encryption.vb" /> <Compile Include="Helper\Encryption.vb" />
<Compile Include="Helper\FixPageRotation.vb" /> <Compile Include="Helper\FixPageRotation.vb" />
<Compile Include="Helper\FlattenFormFields.vb" />
<Compile Include="Helper\RefreshHelper.vb" /> <Compile Include="Helper\RefreshHelper.vb" />
<Compile Include="Helper\TempFiles.vb" /> <Compile Include="Helper\TempFiles.vb" />
<Compile Include="Helper\Thumbnail.vb" /> <Compile Include="Helper\Thumbnail.vb" />

View File

@ -0,0 +1,32 @@
Imports System.IO
Imports GdPicture14
Public Class FlattenFormFields
Public Shared Function FlattenFormFields(pFilePath As String) As String
Dim oFolder As String = Path.GetDirectoryName(pFilePath)
Dim gdpicturePdf As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePdf.LoadFromFile(pFilePath, True)
If status = GdPictureStatus.OK Then
Dim oFormFieldsCount = gdpicturePdf.GetFormFieldsCount()
If oFormFieldsCount > 0 Then
gdpicturePdf.FlattenFormFields()
Dim newFilesPath As String = Path.Combine(oFolder, "InputFieldsFlattend_" & Path.GetFileName(pFilePath))
If gdpicturePdf.SaveToFile(newFilesPath) = GdPictureStatus.OK Then
Return newFilesPath
End If
End If
End If
Return pFilePath
End Function
End Class