Add Export to Y Conversion to plain PDF

This commit is contained in:
Jonathan Jenne 2023-11-30 11:50:13 +01:00
parent f601485bc4
commit f0a36dc43a
4 changed files with 101 additions and 94 deletions

View File

@ -121,6 +121,7 @@
<File Id="DDCommonGUIs" Name="DigitalData.GUIs.Common.dll" Source="DigitalData.GUIs.Common.dll"/> <File Id="DDCommonGUIs" Name="DigitalData.GUIs.Common.dll" Source="DigitalData.GUIs.Common.dll"/>
<File Id="DDConfig" Name="DigitalData.Modules.Config.dll" Source="DigitalData.Modules.Config.dll"/> <File Id="DDConfig" Name="DigitalData.Modules.Config.dll" Source="DigitalData.Modules.Config.dll"/>
<File Id="DDLogging" Name="DigitalData.Modules.Logging.dll" Source="DigitalData.Modules.Logging.dll"/> <File Id="DDLogging" Name="DigitalData.Modules.Logging.dll" Source="DigitalData.Modules.Logging.dll"/>
<File Id="DDInterfaces" Name="DigitalData.Modules.Interfaces.dll" Source="DigitalData.Modules.Interfaces.dll"/>
<File Id="DDBase" Name="DigitalData.Modules.Base.dll" Source="DigitalData.Modules.Base.dll"/> <File Id="DDBase" Name="DigitalData.Modules.Base.dll" Source="DigitalData.Modules.Base.dll"/>
<File Id="DDLanguage" Name="DigitalData.Modules.Language.dll" Source="DigitalData.Modules.Language.dll"/> <File Id="DDLanguage" Name="DigitalData.Modules.Language.dll" Source="DigitalData.Modules.Language.dll"/>
<File Id="DDFilesystem" Name="DigitalData.Modules.Filesystem.dll" Source="DigitalData.Modules.Filesystem.dll"/> <File Id="DDFilesystem" Name="DigitalData.Modules.Filesystem.dll" Source="DigitalData.Modules.Filesystem.dll"/>

View File

@ -173,6 +173,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DDModules\EDMIAPI\bin\Debug\DigitalData.Modules.EDMI.API.dll</HintPath> <HintPath>..\..\..\DDModules\EDMIAPI\bin\Debug\DigitalData.Modules.EDMI.API.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Interfaces">
<HintPath>..\..\..\DDModules\Interfaces\bin\Debug\DigitalData.Modules.Interfaces.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Language, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Language, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DDModules\Language\bin\Debug\DigitalData.Modules.Language.dll</HintPath> <HintPath>..\..\..\DDModules\Language\bin\Debug\DigitalData.Modules.Language.dll</HintPath>

View File

@ -3284,12 +3284,4 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.FILE_COUNT > 0 AND T.GUID IN (SELECT PROFILE_
Private Sub BBtnItmNotfications_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BBtnItmNotfications.ItemClick Private Sub BBtnItmNotfications_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BBtnItmNotfications.ItemClick
Open_Notifications_Form() Open_Notifications_Form()
End Sub End Sub
Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click
End Sub
Private Sub BarButtonItem3_ItemClick_2(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
End Sub
End Class End Class

View File

@ -9,6 +9,7 @@ Imports DigitalData.GUIs.Common.DocumentResultList
Imports DigitalData.Modules.Base Imports DigitalData.Modules.Base
Imports DigitalData.Modules.EDMI.API.Constants Imports DigitalData.Modules.EDMI.API.Constants
Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback
Imports DigitalData.Modules.Interfaces
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.ZooFlow Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.ZooFlow.Constants Imports DigitalData.Modules.ZooFlow.Constants
@ -619,7 +620,7 @@ Public Class frmValidator
Logger.Warn("Error in LookUpLoadSQLData: " & ex.Message) Logger.Warn("Error in LookUpLoadSQLData: " & ex.Message)
End Try End Try
ElseIf TypeOf control Is TextEdit Or TypeOf control Is memoedit Then ElseIf TypeOf control Is TextEdit Or TypeOf control Is MemoEdit Then
Try Try
Dim firstRow As DataRow = oDTContent.Rows(0) Dim firstRow As DataRow = oDTContent.Rows(0)
@ -5616,94 +5617,104 @@ Public Class frmValidator
End Sub End Sub
Private Sub barbtnitmExport_ItemClick(sender As Object, e As ItemClickEventArgs) Handles barbtnitmExport.ItemClick Private Sub barbtnitmExport_ItemClick(sender As Object, e As ItemClickEventArgs) Handles barbtnitmExport.ItemClick
If File.Exists(WMDocPathWindows) Then If File.Exists(WMDocPathWindows) = False Then
Try
Dim oFilenameOnly As String
Dim oExtension As String
Dim oTargetPath As String
Dim oFile2Export As String
If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
Dim oCount As Integer = 0
oFilenameOnly = Path.GetFileName(WMDocPathWindows)
oExtension = Path.GetExtension(WMDocPathWindows)
Dim oSQLGetFilename As String
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbNewLine &
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {CURRENT_DOC_ID}, 1, @Outputfilename = @Filename OUTPUT;" & vbNewLine &
"SELECT @Filename"
Dim oExportFilename = DatabaseFallback.GetScalarValueECM(oSQLGetFilename)
If Not IsNothing(oExportFilename) Then
If IsDBNull(oExportFilename) Then
Logger.Info($"#### ATTENTION: oExportFilename is DBNULL - SQL: {oSQLGetFilename}")
oExportFilename = ""
End If
If oExportFilename <> String.Empty Then
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oExportFilename & oExtension
If Not IsNothing(barbtnitmExport.Tag) Then
If barbtnitmExport.Tag.ToString = "Convert to PDF" Then
If oExtension.EndsWith("pdf") Then
Dim oTempPath = System.IO.Path.GetTempPath()
Dim oTempFullFilename = oTempPath + "\" + oExportFilename & oExtension
'We assume that GdPicture has been correctly installed and unlocked.
NeueDLL
End If
End If
Else
oFile2Export = WMDocPathWindows
End If
File.Copy(oFile2Export, oTargetPath)
Logger.Info($"File {WMDocPathWindows} exported successfully!")
oCount += 1
Else
MsgBox("Error encountered while extracting Export-Filename!" & vbNewLine & "Please inform Admin-Team!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
End If
End If
Dim oFileCount As Integer = 1
If Not IsNothing(DT_AdditionalSearches_Resultset_Docs) Then
For Each oFileRecord As DataRow In DT_AdditionalSearches_Resultset_Docs.Rows
Dim oFromFilename = oFileRecord.Item("FULL_FILENAME")
Dim oDocID = oFileRecord.Item("DocID")
If File.Exists(oFromFilename) Then
oFileCount += 1
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbNewLine &
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {oDocID}, {oFileCount}, @Outputfilename = @Filename OUTPUT;" & vbNewLine &
"SELECT @Filename"
oExportFilename = DatabaseFallback.GetScalarValueECM(oSQLGetFilename)
oExtension = Path.GetExtension(oFromFilename)
If Not IsNothing(oExportFilename) Then
If IsDBNull(oExportFilename) Then
Logger.Info($"#### ATTENTION: oExportFilename is DBNULL - SQL: {oSQLGetFilename}")
oExportFilename = ""
End If
If oExportFilename <> String.Empty Then
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oExportFilename & oExtension
File.Copy(oFromFilename, oTargetPath)
oCount += 1
Else
Dim omsg = $"Error encountered while extracting ATTACHMENT-Export-Filename DocID [{oDocID}]!"
Logger.Info($"#### ATTENTION: {omsg} SQL: {oSQLGetFilename}")
MsgBox(omsg & vbNewLine & "Please inform Admin-Team!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
End If
End If
'oFilenameOnly = Path.GetFileName(oFromFilename)
End If
Next
End If
CONFIG.Config.LastExportPath = FolderBrowserDialog1.SelectedPath
CONFIG.Save()
MsgBox($"[{oCount}] file/s successfully exported to target [{FolderBrowserDialog1.SelectedPath}]!", MsgBoxStyle.Information, ADDITIONAL_TITLE)
End If
Catch ex As Exception
Logger.Error(ex)
MsgBox("Could not move file to target: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, ADDITIONAL_TITLE)
End Try
Else
MsgBox("Workflow-Document seems not to exist. Check Your log.", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE) MsgBox("Workflow-Document seems not to exist. Check Your log.", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
Exit Sub
End If End If
Try
Dim oFilenameOnly As String
Dim oExtension As String
Dim oTargetPath As String
Dim oFile2Export As String
Dim oCount As Integer = 0
Dim oSQLGetFilename As String
If FolderBrowserDialog1.ShowDialog <> DialogResult.OK Then
Exit Sub
End If
oFilenameOnly = Path.GetFileName(WMDocPathWindows)
oExtension = Path.GetExtension(WMDocPathWindows)
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbNewLine &
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {CURRENT_DOC_ID}, 1, @Outputfilename = @Filename OUTPUT;" & vbNewLine &
"SELECT @Filename"
Dim oExportFilename = DatabaseFallback.GetScalarValueECM(oSQLGetFilename)
If Not IsNothing(oExportFilename) Then
If IsDBNull(oExportFilename) Then
Logger.Info($"#### ATTENTION: oExportFilename is DBNULL - SQL: {oSQLGetFilename}")
oExportFilename = ""
End If
If oExportFilename <> String.Empty Then
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oExportFilename & oExtension
If Not IsNothing(barbtnitmExport.Tag) Then
If barbtnitmExport.Tag.ToString = "Convert to PDF" Then
If oExtension.EndsWith("pdf") Then
Dim oTempPath = System.IO.Path.GetTempPath()
Dim oTempFullFilename = oTempPath + "\" + oExportFilename & oExtension
Dim oConverter As New PDFConverter(LOGCONFIG)
If oConverter.ConvertPDFADocumentToPDFDocument(WMDocPathWindows, oTempFullFilename) = False Then
Logger.Warn("File [{0}] could not be converted to plain PDF!", WMDocPathWindows)
End If
oFile2Export = oTempPath
End If
End If
Else
oFile2Export = WMDocPathWindows
End If
File.Copy(oFile2Export, oTargetPath)
Logger.Info($"File {WMDocPathWindows} exported successfully!")
oCount += 1
Else
MsgBox("Error encountered while extracting Export-Filename!" & vbNewLine & "Please inform Admin-Team!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
End If
End If
Dim oFileCount As Integer = 1
If Not IsNothing(DT_AdditionalSearches_Resultset_Docs) Then
For Each oFileRecord As DataRow In DT_AdditionalSearches_Resultset_Docs.Rows
Dim oFromFilename = oFileRecord.Item("FULL_FILENAME")
Dim oDocID = oFileRecord.Item("DocID")
If File.Exists(oFromFilename) Then
oFileCount += 1
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbNewLine &
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {oDocID}, {oFileCount}, @Outputfilename = @Filename OUTPUT;" & vbNewLine &
"SELECT @Filename"
oExportFilename = DatabaseFallback.GetScalarValueECM(oSQLGetFilename)
oExtension = Path.GetExtension(oFromFilename)
If Not IsNothing(oExportFilename) Then
If IsDBNull(oExportFilename) Then
Logger.Info($"#### ATTENTION: oExportFilename is DBNULL - SQL: {oSQLGetFilename}")
oExportFilename = ""
End If
If oExportFilename <> String.Empty Then
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oExportFilename & oExtension
File.Copy(oFromFilename, oTargetPath)
oCount += 1
Else
Dim omsg = $"Error encountered while extracting ATTACHMENT-Export-Filename DocID [{oDocID}]!"
Logger.Info($"#### ATTENTION: {omsg} SQL: {oSQLGetFilename}")
MsgBox(omsg & vbNewLine & "Please inform Admin-Team!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
End If
End If
'oFilenameOnly = Path.GetFileName(oFromFilename)
End If
Next
End If
CONFIG.Config.LastExportPath = FolderBrowserDialog1.SelectedPath
CONFIG.Save()
MsgBox($"[{oCount}] file/s successfully exported to target [{FolderBrowserDialog1.SelectedPath}]!", MsgBoxStyle.Information, ADDITIONAL_TITLE)
Catch ex As Exception
Logger.Error(ex)
MsgBox("Could not move file to target: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, ADDITIONAL_TITLE)
End Try
End Sub End Sub