This commit is contained in:
2019-11-26 14:39:09 +01:00
parent 490ef4a702
commit ca1cc4f8fa
52 changed files with 8152 additions and 4542 deletions

View File

@@ -448,7 +448,7 @@ Public Class cDATENSERVER
' Return True
' Catch ex As Exception
' MsgBox(ex.Message)
' MsgBox(ex.Message & ex.StackTrace)
' Return False
' End Try
'End Function
@@ -897,7 +897,7 @@ Public Class cFormularManager
pdf.Close()
Return destPath
Catch ex As Exception
MsgBox(ex.Message)
MsgBox(ex.Message & ex.StackTrace)
Return ""
End Try
@@ -1110,6 +1110,51 @@ Public Class cFormularManager
End Try
End Sub
Shared Function getTMPPath_PDF() As String
Return System.IO.Path.GetTempPath() & Guid.NewGuid().ToString() & ".pdf"
End Function
Public Shared Function getPDFViaSpirePDF_FromURL(URL As String, Optional targetPath As String = "") As String
Try
If targetPath = "" Then targetPath = getTMPPath_PDF()
Dim doc As New Spire.Pdf.PdfDocument '= New Spire.Pdf.PdfDocument(URL)
doc.LoadFromHTML(URL, True, True, True)
If doc IsNot Nothing Then
doc.PageSettings.Size = Spire.Pdf.PdfPageSize.A4
doc.PrintDocument.DefaultPageSettings.Landscape = True
doc.PageScaling = Spire.Pdf.PdfPrintPageScaling.FitSize
' doc.PrinterName = printerName
' doc.PrintDocument.Print()
doc.SaveToFile(targetPath)
End If
'For Each doc As Spire.Pdf.PdfDocument In docs
'Dim doc As New Spire.Pdf.PdfDocument()
'Using webClient As New Net.WebClient()
' Dim data() As Byte = webClient.DownloadData(URL)
' Using stream As New MemoryStream(data)
' Dim doc As Spire.Pdf.PdfDocument = New Spire.Pdf.PdfDocument(stream)
' If doc IsNot Nothing Then
' doc.PageSettings.Size = Spire.Pdf.PdfPageSize.A4
' doc.PrintDocument.DefaultPageSettings.Landscape = True
' doc.PageScaling = Spire.Pdf.PdfPrintPageScaling.FitSize
' ' doc.PrinterName = printerName
' ' doc.PrintDocument.Print()
' doc.SaveToFile(targetPath)
' End If
' End Using
'End Using
' doc.LoadFromHTML(pdfPath, True, True, True)
Return targetPath
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
Return ""
End Function
@@ -1550,7 +1595,7 @@ Public Class DATENVERVER_OPTIONS
IO.File.Copy(pfad, tmpPath)
Return tmpPath
Catch ex As Exception
MsgBox(ex.Message)
MsgBox(ex.Message & ex.StackTrace)
End Try
Return pfad
End Function
@@ -1562,7 +1607,7 @@ Public Class DATENVERVER_OPTIONS
IO.File.Copy(pfad, tmpPath)
Return tmpPath
Catch ex As Exception
MsgBox(ex.Message)
MsgBox(ex.Message & ex.StackTrace)
End Try
Return pfad
End Function
@@ -1703,7 +1748,7 @@ Public Class DATENVERVER_OPTIONS
Return True
Catch ex As Exception
MsgBox(ex.Message)
MsgBox(ex.Message & ex.StackTrace)
Return False
End Try
End Function