You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
195 lines
6.4 KiB
195 lines
6.4 KiB
Imports System.Data
|
|
Imports System.Data.SqlClient
|
|
Imports System.Data.SqlTypes
|
|
Public Class clsPDFHandling
|
|
Public Enum enum_Printtype
|
|
PDFPrintingNet = 1
|
|
ShowAcrobat = 2
|
|
EDOKA_Default = 3
|
|
End Enum
|
|
|
|
Public Enum Printtype
|
|
Serienbrief = 1
|
|
Banklagernd = 2
|
|
Mehrfachdruck = 3
|
|
End Enum
|
|
|
|
Public Enum Enum_DisplayType
|
|
ShowAcrobat = 1
|
|
EDOKA_Default = 2
|
|
End Enum
|
|
|
|
Public Enum Enum_SimplexDuplex
|
|
Simplex = 1
|
|
Duplex = 2
|
|
End Enum
|
|
|
|
|
|
Dim m_Printtype_Serienbrief As enum_Printtype
|
|
Property Printtype_Serienbrief As Integer
|
|
Get
|
|
Return m_Printtype_Serienbrief
|
|
End Get
|
|
Set(value As Integer)
|
|
m_Printtype_Serienbrief = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_Printtype_Banklagernd As enum_Printtype
|
|
Property Printtype_Banklagernd As Integer
|
|
Get
|
|
Return m_Printtype_Banklagernd
|
|
End Get
|
|
Set(value As Integer)
|
|
m_Printtype_Banklagernd = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_Printtype_Mehrfachdruck As enum_Printtype
|
|
Property Printtype_Mehrfachdruck As Integer
|
|
Get
|
|
Return m_Printtype_Mehrfachdruck
|
|
End Get
|
|
Set(value As Integer)
|
|
m_Printtype_Mehrfachdruck = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_DisplayType As Enum_DisplayType
|
|
Property DisplayType As Integer
|
|
Get
|
|
Return m_DisplayType
|
|
End Get
|
|
Set(value As Integer)
|
|
m_DisplayType = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_PDFPrint_SimplexDuplex As Enum_SimplexDuplex
|
|
Property PDFPrint_Simplexduplex As Integer
|
|
Get
|
|
Return m_PDFPrint_SimplexDuplex
|
|
End Get
|
|
Set(value As Integer)
|
|
m_PDFPrint_SimplexDuplex = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_PDFPrint_UseAcrobat As Boolean
|
|
Property PDFPrint_UseAcrobat As Boolean
|
|
Get
|
|
Return m_PDFPrint_UseAcrobat
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_PDFPrint_UseAcrobat = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_scale As Integer
|
|
Property Scale As Integer
|
|
Get
|
|
Return m_scale
|
|
End Get
|
|
Set(value As Integer)
|
|
m_scale = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim Message As String
|
|
Dim ShowMessage As Boolean = False
|
|
Sub New()
|
|
get_db_params
|
|
End Sub
|
|
|
|
|
|
Sub Get_DB_params()
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
scmCmdToExecute.CommandText = "dbo.sp_Get_PDFPrint_Params"
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
Try
|
|
sdaAdapter.Fill(dtToReturn)
|
|
For Each r As DataRow In dtToReturn.Rows
|
|
Select Case r("Eintragnr")
|
|
Case 1
|
|
Me.Printtype_Serienbrief = r("Beschreibung")
|
|
Case 2
|
|
Me.Printtype_Banklagernd = r("Beschreibung")
|
|
Case 3
|
|
Me.Printtype_Mehrfachdruck = r("Beschreibung")
|
|
Case 4
|
|
Me.DisplayType = r("Beschreibung")
|
|
Case 5
|
|
If r("Beschreibung") = "Simplex" Then Me.PDFPrint_Simplexduplex = Enum_SimplexDuplex.Simplex Else Me.PDFPrint_Simplexduplex = Enum_SimplexDuplex.Duplex
|
|
Case 6
|
|
If r("Beschreibung") = "True" Then Me.PDFPrint_UseAcrobat = True Else Me.PDFPrint_UseAcrobat = False
|
|
Case 7
|
|
Me.ShowMessage = r("Beschreibung") = "True"
|
|
Case 8
|
|
Me.Message = r("Beschreibung")
|
|
Case 9
|
|
Me.Scale = r("Beschreibung")
|
|
|
|
End Select
|
|
Next
|
|
Catch ex As Exception
|
|
Throw New Exception("clsPDFHandling:Get_Print_Params::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
Finally
|
|
scmCmdToExecute.Dispose()
|
|
sdaAdapter.Dispose()
|
|
End Try
|
|
End Sub
|
|
|
|
Public Function ShowPDF(ByVal druckjobname As String)
|
|
If druckjobname = "" Then Exit Function
|
|
Dim p As New System.Diagnostics.Process
|
|
Dim s As New System.Diagnostics.ProcessStartInfo(druckjobname)
|
|
s.UseShellExecute = True
|
|
s.WindowStyle = ProcessWindowStyle.Normal
|
|
p.StartInfo = s
|
|
p.Start()
|
|
'Shell(druckjobname)
|
|
End Function
|
|
|
|
Public Function Print_ShowPDF(ByVal druckjobname As String)
|
|
If druckjobname = "" Then Exit Function
|
|
If Me.ShowMessage = True Then MsgBox(Me.Message, vbInformation)
|
|
Dim p As New System.Diagnostics.Process
|
|
Dim s As New System.Diagnostics.ProcessStartInfo(druckjobname)
|
|
s.UseShellExecute = True
|
|
s.WindowStyle = ProcessWindowStyle.Normal
|
|
p.StartInfo = s
|
|
p.Start()
|
|
'Shell(druckjobname)
|
|
End Function
|
|
|
|
Public Function PrintPDF(ByVal Druckjobname As String, ByVal Type As Integer)
|
|
Dim f As New frmPDFPrintDialog
|
|
f.Show()
|
|
f.Refresh()
|
|
If Druckjobname = "" Then Exit Function
|
|
Dim d As New PdfPrintingNet.PdfPrint("Stefan Hutter Unternehmensberatung", "g/4JFMjn6Kusgv2qexbT39MJftihsDgvMBvRYSjMS0XZnwOXJu1IvCSStd15H8bk0KaA3czA6F8=")
|
|
If Me.PDFPrint_Simplexduplex = Enum_SimplexDuplex.Simplex Then
|
|
d.DuplexType = System.Drawing.Printing.Duplex.Simplex
|
|
Else
|
|
d.DuplexType = System.Drawing.Printing.Duplex.Vertical
|
|
End If
|
|
Select Case Me.Scale
|
|
Case 1
|
|
d.Scale = PdfPrintingNet.PdfPrint.ScaleTypes.FitToMargins
|
|
Case 2
|
|
d.Scale = PdfPrintingNet.PdfPrint.ScaleTypes.None
|
|
Case 3
|
|
d.Scale = PdfPrintingNet.PdfPrint.ScaleTypes.Shrink
|
|
End Select
|
|
If Me.PDFPrint_UseAcrobat = "True" Then
|
|
d.PrintWithAdobe(Druckjobname)
|
|
Else
|
|
d.Print(Druckjobname)
|
|
End If
|
|
f.Close()
|
|
End Function
|
|
End Class
|