MS Multiple Files Dialog, Qualifizierte Signatur weg

This commit is contained in:
Developer01
2024-11-08 11:48:58 +01:00
parent 683ff03a0f
commit 57f8d0e398
15 changed files with 518 additions and 25 deletions

View File

@@ -0,0 +1,96 @@
Imports DevExpress.XtraSplashScreen
Imports EnvelopeGenerator.Common
Imports DigitalData.Modules.Logging
Imports GdPicture14
Public Class frmChooseDocVariant
Private TempFiles As TempFiles
Public Property State As State
Private Logger As Logger
Private Sub frmChooseDocVariant_Load(sender As Object, e As EventArgs) Handles Me.Load
ENVELOPE_TEMP_DOCUMENT = ""
TempFiles = New TempFiles(State.LogConfig)
TempFiles.Create()
Logger = State.LogConfig.GetLogger()
End Sub
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs)
OpenFileDialog1.Multiselect = False
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
Try
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
ENVELOPE_TEMP_DOCUMENT = OpenFileDialog1.FileName
End If
Catch ex As Exception
Logger.Error(ex)
Finally
SplashScreenManager.CloseOverlayForm(oHandle)
End Try
' Else
' SplashScreenManager.CloseOverlayForm(oHandle)
' End If
End Sub
Private Sub SimpleButton2_Click(sender As Object, e As EventArgs) Handles SimpleButton2.Click
OpenFileDialog1.Multiselect = True
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
Try
Dim oErr As Boolean = False
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Dim oIDX As Integer = 0
For Each oFile As String In OpenFileDialog1.FileNames
oIDX += 1
Next
Dim arPDF As GdPicturePDF() = New GdPicturePDF(oIDX) {}
oIDX = 0
For Each oFile As String In OpenFileDialog1.FileNames
arPDF(oIDX) = New GdPicturePDF()
If arPDF(oIDX).LoadFromFile(oFile) <> GdPictureStatus.OK Then
MsgBox($"PDF Statsu of file {oFile} is not OK. Please check PDF-conformity!", MsgBoxStyle.Critical)
oErr = True
Exit For
End If
oIDX += 1
Next
If oErr = False Then
Dim dstPDF As GdPicturePDF = arPDF(0).MergeDocuments(arPDF)
Dim oStatus As GdPictureStatus = arPDF(0).GetStat()
If oStatus = GdPictureStatus.OK Then
MsgBox("All documents have been successfully merged.", MsgBoxStyle.Information)
Dim oTempFolder = TempFiles.TempPath
Dim oTempFilename = String.Concat(oTempFolder, "\", $"MergedDoc.pdf")
If System.IO.File.Exists(oTempFilename) Then
System.IO.File.Delete(oTempFilename)
End If
If dstPDF.SaveToFile(oTempFilename) = GdPictureStatus.OK Then
MessageBox.Show("Merged document has been successfully saved.", "Example: MergeDocuments")
ENVELOPE_TEMP_DOCUMENT = oTempFilename
dstPDF.CloseDocument()
End If
Else
MessageBox.Show("The MergeDocuments() method has failed with the status: " + oStatus.ToString(), "Example: MergeDocuments")
End If
dstPDF.Dispose()
oIDX = 0
For Each oFile As String In OpenFileDialog1.FileNames
arPDF(oIDX).CloseDocument()
oIDX += 1
Next
End If
End If
Catch ex As Exception
Logger.Error(ex)
Finally
SplashScreenManager.CloseOverlayForm(oHandle)
End Try
End Sub
Private Sub LabelControl1_Click(sender As Object, e As EventArgs) Handles LabelControl1.Click
End Sub
End Class