ViewDocument before GDPicture Update
This commit is contained in:
parent
51798a28f5
commit
e9427b35be
@ -17,9 +17,6 @@ Public Class XRechnungViewDocument
|
||||
Private fontResName As String
|
||||
Private fontResNameBold As String
|
||||
Private fontResNameItalic As String
|
||||
Private MyGDPicturePDF As GdPicturePDF
|
||||
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer, GDPictureLicenseKey As String)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
@ -51,8 +48,18 @@ Public Class XRechnungViewDocument
|
||||
|
||||
'oViewRecieptFilename = oViewRecieptFilename.Replace(".xml", ".pdf")
|
||||
oViewRecieptFilename = Regex.Replace(oViewRecieptFilename, ".xml", ".pdf", RegexOptions.IgnoreCase)
|
||||
Using gdpicturePDF As New GdPicturePDF()
|
||||
' Create a new PDF/A-2a compliant document (blank, no pages yet)
|
||||
Dim status As GdPictureStatus = gdpicturePDF.NewPDF(PdfConformance.PDF_A_2a)
|
||||
If status = GdPictureStatus.OK Then
|
||||
|
||||
MyGDPicturePDF = New GdPicturePDF()
|
||||
|
||||
|
||||
Else
|
||||
MsgBox("The NewPDF(PdfConformance.PDF_A_2a) method has failed with the status: " + status.ToString(), "Example: NewPDF")
|
||||
End If
|
||||
End Using
|
||||
Dim MyGDPicturePDF = New GdPicturePDF()
|
||||
|
||||
Dim oPDFStatus As GdPictureStatus = MyGDPicturePDF.NewPDF(PdfConformance.PDF_A_2a)
|
||||
|
||||
@ -70,7 +77,7 @@ Public Class XRechnungViewDocument
|
||||
_logger.Debug("Vor MOVE... oxmlFilePath: [{0}] / oTempFilePath: [{1}]", oXmlFilePath, oTempFilePath)
|
||||
|
||||
File.Move(oXmlFilePath, oTempFilePath)
|
||||
|
||||
Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {Now.ToString}"
|
||||
MyGDPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
|
||||
MyGDPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
|
||||
MyGDPicturePDF.SetLineWidth(1)
|
||||
@ -82,10 +89,23 @@ Public Class XRechnungViewDocument
|
||||
'Create a New page
|
||||
MyGDPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
|
||||
' Dim oCurrent As Integer = MyGDPicturePDF.GetCurrentPage()
|
||||
'Den HEader erzeugen
|
||||
Dim yPosition As Integer = 15
|
||||
MyGDPicturePDF.SetTextSize(18)
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
|
||||
yPosition += 10
|
||||
MyGDPicturePDF.SetTextSize(10)
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2)
|
||||
'Den Footer erzeugen
|
||||
MyGDPicturePDF.DrawLine(10, 280, 200, 280)
|
||||
|
||||
Dim yPosition As Single = Create_PageHeader(False)
|
||||
|
||||
Create_PageFooter()
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
|
||||
|
||||
Dim oArea As String = ""
|
||||
Dim oIsPosition As Boolean = False
|
||||
@ -120,8 +140,23 @@ Public Class XRechnungViewDocument
|
||||
_logger.Warn($"Could not create a second page. The error was: {oPDFStatus}")
|
||||
Exit For
|
||||
Else
|
||||
yPosition = Create_PageHeader(True)
|
||||
Create_PageFooter()
|
||||
'Wieder einen Header und Footer erzeugen
|
||||
yPosition = 15
|
||||
MyGDPicturePDF.SetTextSize(18)
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
|
||||
yPosition += 10
|
||||
MyGDPicturePDF.SetTextSize(10)
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2)
|
||||
|
||||
MyGDPicturePDF.DrawLine(10, 280, 200, 280)
|
||||
'Footer erzeugen
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
|
||||
End If
|
||||
'oCurrent = MyGDPicturePDF.GetCurrentPage()
|
||||
End If
|
||||
@ -488,29 +523,6 @@ Public Class XRechnungViewDocument
|
||||
Dim lines As List(Of String) = text.Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.None).ToList()
|
||||
Return lines
|
||||
End Function
|
||||
Public Function Create_PageHeader(pFollowPage As Boolean) As Integer
|
||||
'Draw content on the PDF
|
||||
Dim yPosition As Integer = 15
|
||||
MyGDPicturePDF.SetTextSize(18)
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
|
||||
yPosition += 10
|
||||
MyGDPicturePDF.SetTextSize(10)
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1)
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2)
|
||||
Return yPosition
|
||||
End Function
|
||||
|
||||
Public Sub Create_PageFooter()
|
||||
MyGDPicturePDF.DrawLine(10, 280, 200, 280)
|
||||
Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {Now.ToString}"
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
|
||||
End Sub
|
||||
|
||||
Private Function Return_InvType(pType As String) As String
|
||||
Dim oReturn As String = "Rechnung/invoice"
|
||||
If pType = "380" Then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user