Migliorie codice preview PDF

This commit is contained in:
Demetrio Cassarino
2023-09-28 17:19:38 +02:00
parent 947c776d83
commit 7bfd834b0e
3 changed files with 26 additions and 14 deletions
@@ -33,7 +33,6 @@ Public Class PDFEditorVM
End Set
End Property
' Definizione comandi
Private m_cmdCreatePDFPreviewVis As ICommand
Private m_cmdCreatePDFPreviewOtt As ICommand
@@ -148,7 +147,7 @@ Public Class ExpanderPDF
End Get
End Property
#End Region ' FIELDS & PROPERTIES
#End Region ' Fields & Properties
#Region "CONTRUCTORS"
@@ -189,7 +188,7 @@ Public Class ExpanderPDF
End Select
End Sub
#End Region ' CONTRUCTORS
#End Region ' Constructors
End Class
@@ -219,7 +218,7 @@ Public Class ExpanderElement
End Set
End Property
#End Region 'FIELDS & PROPERTIES
#End Region 'Fields & Properties
#Region "CONTRUCTORS"
@@ -228,7 +227,7 @@ Public Class ExpanderElement
m_bParameter_IsChecked = GetMainPrivateProfileInt(S_PDFEDITOR, m_sNameParameter, 0) <> 0
End Sub
#End Region 'CONTRUCTORS
#End Region 'Constructors
End Class
@@ -237,6 +236,8 @@ Public Class ExpanderTable
#Region "FIELDS & PROPERTIES"
#Region "RAWPARTCOLUMNS"
'Lista Colonne Tabella MachGroup List, RawPart List, PartList
Private m_RawPartColumns As New ObservableCollection(Of EgtDataGridColumn)
Public ReadOnly Property RawPartColumns As ObservableCollection(Of EgtDataGridColumn)
@@ -256,7 +257,11 @@ Public Class ExpanderTable
End Set
End Property
'Visualizza Sezione ed Immagine solo se fa parte di DG_Statistics_PART
#End Region ' RawPartColumns
#Region "SECTION & IMAGE"
' Visualizza Sezione ed Immagine solo se fa parte di DG_Statistics_PART
Private m_vRawPartVisibility As Visibility
Public ReadOnly Property vRawPartVisibility As Visibility
Get
@@ -264,7 +269,7 @@ Public Class ExpanderTable
End Get
End Property
'Check Box per la visualizzazione nel PDF della sezione
' Check Box per la visualizzazione nel PDF della sezione
Private m_bSection_IsChecked As Boolean
Public Property bSection_IsChecked As Boolean
Get
@@ -277,7 +282,7 @@ Public Class ExpanderTable
End Set
End Property
'Check Box per la visualizzazione nel PDF dell' immagine
' Check Box per la visualizzazione nel PDF dell' immagine
Private m_bImage_IsChecked As Boolean
Public Property bImage_IsChecked As Boolean
Get
@@ -290,6 +295,10 @@ Public Class ExpanderTable
End Set
End Property
#End Region ' Section & Image
#End Region ' FIELDS & PROPERTIES
#Region "MESSAGES"
Public ReadOnly Property Section_Msg As String
@@ -306,8 +315,6 @@ Public Class ExpanderTable
#End Region ' Messages
#End Region ' FIELDS & PROPERTIES
' Definizione comandi
Private m_cmdMoveUpOrder As ICommand
Private m_cmdMoveDownOrder As ICommand
@@ -321,7 +328,7 @@ Public Class ExpanderTable
m_bImage_IsChecked = GetMainPrivateProfileInt(S_PDFEDITOR, S_IMAGE, 0) <> 0
End Sub
#End Region ' CONTRUCTORS
#End Region ' Constructors
#Region "COMMANDS"
@@ -371,7 +378,7 @@ Public Class ExpanderTable
#End Region ' MoveDownOrder
#End Region ' COMMANDS
#End Region ' Commands
End Class
@@ -153,6 +153,10 @@ Module PDFHelper
Dim sTVolume As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_TOTVOLUME) ' Recupero colonna 'colTotVolume' con relativo checkbox
Dim sTTime As EgtDataGridColumn = sMachGroupList.RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_TOTTIME) ' Recupero colonna 'colTotTime' con relativo checkbox
Dim section As Section = document.LastSection()
DefineItem(document, nListType, bPreview, sMachGroupList, sName, sW, sH, sL, sMaterial, sUsage, sWaste, sUTime, sQty, sPDN, sDesc, sCNT, sAdded, sDone, sUVolume, sTVolume, sTTime, section)
End Sub
Private Sub DefineItem(document As Document, nListType As ListTypes, bPreview As Boolean, sMachGroupList As ExpanderTable, sName As EgtDataGridColumn, sW As EgtDataGridColumn, sH As EgtDataGridColumn, sL As EgtDataGridColumn, sMaterial As EgtDataGridColumn, sUsage As EgtDataGridColumn, sWaste As EgtDataGridColumn, sUTime As EgtDataGridColumn, sQty As EgtDataGridColumn, sPDN As EgtDataGridColumn, sDesc As EgtDataGridColumn, sCNT As EgtDataGridColumn, sAdded As EgtDataGridColumn, sDone As EgtDataGridColumn, sUVolume As EgtDataGridColumn, sTVolume As EgtDataGridColumn, sTTime As EgtDataGridColumn, section As Section)
Select Case nListType
Case ListTypes.PART
section.AddParagraph("Part List", "Heading2")
@@ -324,8 +324,9 @@ Public Class StatisticsVM
Dim document As Document = PDFHelper.CreateStatReport(ActivePage, bPreview)
Dim documentPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\MigraDoc.mdddl"
MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, documentPath)
Dim renderer As New PdfDocumentRenderer(True)
renderer.Document = document
Dim renderer As New PdfDocumentRenderer(True) With {
.Document = document
}
renderer.RenderDocument()
' salvo il documento
Dim sFileName As String = ""