update document viewer
This commit is contained in:
parent
c66a2dc5e5
commit
69a96331bd
@ -23,6 +23,7 @@ Public Class DocumentViewer
|
||||
Private _licenseManager As New GdPicture14.LicenseManager()
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _view_only As Boolean = False
|
||||
|
||||
' List of all created temp files when converting msg files
|
||||
Private _TempFiles As New List(Of String)
|
||||
@ -65,8 +66,9 @@ Public Class DocumentViewer
|
||||
''' Terminate Viewer, freeing up resources and deleting temp files
|
||||
''' </summary>
|
||||
Public Sub Done()
|
||||
_logger.Warn("Called Done, removing temp files")
|
||||
DeleteTempFiles()
|
||||
Dispose()
|
||||
'Dispose()
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
@ -79,16 +81,17 @@ Public Class DocumentViewer
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'_logger.Info("Resetting Viewer.")
|
||||
'GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
'GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
|
||||
_logger.Info("Loading File.")
|
||||
_logger.Info("Loading File {0}", filepath)
|
||||
DoLoadFile(filepath)
|
||||
|
||||
'_logger.Info("Updating UI.")
|
||||
'statusLabel.Text = _docPath
|
||||
' UpdateMainUi()
|
||||
If _view_only Then
|
||||
statusLabel.Text = _docPath
|
||||
End If
|
||||
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
|
||||
Public Sub CloseDocument()
|
||||
@ -132,20 +135,11 @@ Public Class DocumentViewer
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
Case ".xls"
|
||||
Using oConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
|
||||
' Loading the source document.
|
||||
oConverter.LoadFromFile(FilePath, GdPicture14.DocumentFormat.DocumentFormatXLSX)
|
||||
' Saving as the PDF document.
|
||||
oConverter.SaveAsPDF("output.pdf", PdfConformance.PDF1_5)
|
||||
End Using
|
||||
|
||||
_docPath = "output.pdf"
|
||||
|
||||
GdViewer.DisplayFromFile(_docPath)
|
||||
Case Else
|
||||
_docPath = FilePath
|
||||
|
||||
_logger.Info("Displaying file {0}", _docPath)
|
||||
|
||||
GdViewer.DisplayFromFile(_docPath)
|
||||
|
||||
RichEditControl1.Visible = False
|
||||
@ -157,8 +151,6 @@ Public Class DocumentViewer
|
||||
End Sub
|
||||
|
||||
Private Sub btnOpen_Click(sender As Object, e As EventArgs)
|
||||
CloseDocument()
|
||||
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
|
||||
@ -189,19 +181,19 @@ Public Class DocumentViewer
|
||||
Return result
|
||||
End Function
|
||||
|
||||
Public Sub RightOnlyView(oValueRight As Boolean)
|
||||
If oValueRight = True Then
|
||||
Public Sub RightOnlyView(ValueRight As Boolean)
|
||||
If ValueRight Then
|
||||
btnPrint.Visible = False
|
||||
Else
|
||||
btnPrint.Visible = True
|
||||
End If
|
||||
|
||||
_view_only = ValueRight
|
||||
End Sub
|
||||
Private Sub UpdateMainUi()
|
||||
Exit Sub
|
||||
|
||||
If GdViewer.PageCount = 0 Then
|
||||
'btnOpen.Enabled = True
|
||||
btnPrint.Enabled = False
|
||||
btnFirstPage.Enabled = False
|
||||
btnPreviousPage.Enabled = False
|
||||
@ -222,7 +214,6 @@ Public Class DocumentViewer
|
||||
lblPageCount.Text = "/ 0"
|
||||
cbZoom.SelectedIndex = -1
|
||||
Else
|
||||
'btnOpen.Enabled = False
|
||||
btnPrint.Enabled = True
|
||||
btnFirstPage.Enabled = True
|
||||
btnPreviousPage.Enabled = True
|
||||
@ -544,7 +535,8 @@ Public Class DocumentViewer
|
||||
GdViewer.Focus()
|
||||
End Sub
|
||||
|
||||
Private Sub DocumentViewer_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
GdViewer.Dispose()
|
||||
End Sub
|
||||
'Private Sub DocumentViewer_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||||
' _logger.Warn("Disposing GDViewer")
|
||||
' GdViewer.Dispose()
|
||||
'End Sub
|
||||
End Class
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user