ustva->nur betroffene ids-pdf-seiten öffnen
This commit is contained in:
@@ -12,6 +12,7 @@ Imports jdk.nashorn.internal.objects.annotations
|
|||||||
'Imports DocumentFormat.OpenXml.Drawing.Charts
|
'Imports DocumentFormat.OpenXml.Drawing.Charts
|
||||||
Imports Microsoft.Office.Interop
|
Imports Microsoft.Office.Interop
|
||||||
Imports org.BouncyCastle.Pqc.Crypto
|
Imports org.BouncyCastle.Pqc.Crypto
|
||||||
|
Imports sun.swing
|
||||||
Imports VERAG_PROG_ALLGEMEIN
|
Imports VERAG_PROG_ALLGEMEIN
|
||||||
|
|
||||||
Public Class frmMDM_USTVAntrag
|
Public Class frmMDM_USTVAntrag
|
||||||
@@ -1447,51 +1448,67 @@ Public Class frmMDM_USTVAntrag
|
|||||||
cFakturierung.doRechnungsDruck_SRorER(dsID,, False, 3)
|
cFakturierung.doRechnungsDruck_SRorER(dsID,, False, 3)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'----------- ERST AKTIVIEREN; WENN POR ANTRAG RECHNUNG (üer RE-NR)
|
Case 8
|
||||||
|
|
||||||
|
Me.Cursor = Cursors.WaitCursor
|
||||||
|
Dim ds As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
|
||||||
|
Dim path_src As String = ds.OPEN_SINGLE(False)
|
||||||
|
If path_src = "" Then Exit Sub
|
||||||
|
|
||||||
|
Try
|
||||||
|
|
||||||
|
Dim fi As New System.IO.DirectoryInfo(path_src)
|
||||||
|
Dim pdfReader As itextsharp.text.pdf.PdfReader = New itextsharp.text.pdf.PdfReader(path_src)
|
||||||
|
|
||||||
|
Dim TMP_Path_New = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension,, True, "IDS-Rechnungen")
|
||||||
|
Dim srcDoc As New itextsharp.text.Document()
|
||||||
|
Dim PdfCopyProvider As New itextsharp.text.pdf.PdfCopy(srcDoc, New FileStream(TMP_Path_New, System.IO.FileMode.Create))
|
||||||
|
PdfCopyProvider.SetFullCompression()
|
||||||
|
srcDoc.Open()
|
||||||
|
PdfReader.unethicalreading = True
|
||||||
|
Dim pages As New List(Of Integer)()
|
||||||
|
|
||||||
|
For page As Integer = 1 To pdfReader.NumberOfPages
|
||||||
|
|
||||||
|
Dim strategy As ITextExtractionStrategy = New SimpleTextExtractionStrategy()
|
||||||
|
Dim currentpagetext As String = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy)
|
||||||
|
Dim searchtext As String = ReNr
|
||||||
|
Dim impPage As itextsharp.text.pdf.PdfImportedPage = Nothing
|
||||||
|
|
||||||
|
If (currentpagetext.Contains(searchtext)) Then
|
||||||
|
|
||||||
|
If page > pdfReader.NumberOfPages Then
|
||||||
|
MsgBox("Seitenanzahl überschritten!")
|
||||||
|
srcDoc.Close() : pdfReader.Close()
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
Try
|
||||||
|
|
||||||
|
impPage = PdfCopyProvider.GetImportedPage(pdfReader, page)
|
||||||
|
' ----- Ermitteln der Seitenauflösung und setzen für die neue Seite
|
||||||
|
PdfCopyProvider.SetPageSize(New itextsharp.text.Rectangle(0.0F, 0.0F, impPage.Width, impPage.Height, pdfReader.GetPageRotation(page)))
|
||||||
|
' ----- PDF Seite in das neue Dokument einfügen
|
||||||
|
If impPage IsNot Nothing Then PdfCopyProvider.AddPage(impPage)
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
|
||||||
'Case 8
|
End If
|
||||||
|
|
||||||
' Me.Cursor = Cursors.WaitCursor
|
Next
|
||||||
' Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
|
|
||||||
' Dim path_src As String = DS.OPEN_SINGLE(False)
|
|
||||||
' If path_src = "" Then Exit Sub
|
|
||||||
|
|
||||||
' Dim pdfDoc As itextsharp.text.Document = Nothing
|
srcDoc.Close()
|
||||||
|
pdfReader.Close()
|
||||||
|
|
||||||
' Try
|
If IO.File.Exists(TMP_Path_New) Then
|
||||||
|
Process.Start(TMP_Path_New)
|
||||||
' Dim fi As New System.IO.DirectoryInfo(path_src)
|
End If
|
||||||
' Dim pdf As itextsharp.text.pdf.PdfReader = New itextsharp.text.pdf.PdfReader(path_src)
|
|
||||||
' pdf.unethicalreading = True
|
|
||||||
' Dim pages As New List(Of Integer)()
|
|
||||||
|
|
||||||
' For page As Integer = 1 To pdf.NumberOfPages
|
|
||||||
|
|
||||||
' Dim strategy As ITextExtractionStrategy = New SimpleTextExtractionStrategy()
|
|
||||||
' Dim currentPageText As String = PdfTextExtractor.GetTextFromPage(pdf, page, strategy)
|
|
||||||
|
|
||||||
' Dim searchtext As String = "ON BEHALF AND FOR ACCOUNT OF:"
|
|
||||||
' Dim searchtext2 As String = "IDS Europe B.V. " & Antrag_LandKz.ToString
|
|
||||||
|
|
||||||
' If Not (currentPageText.Contains(searchtext) AndAlso currentPageText.Contains(searchtext2)) Then
|
|
||||||
' Dim pageDictionary As PdfDictionary = pdf.GetPageN(page)
|
|
||||||
' pageDictionary.Put(PdfName.PAGEMODE, PdfName.USENONE)
|
|
||||||
' Else
|
|
||||||
' pages.Add(page)
|
|
||||||
' End If
|
|
||||||
|
|
||||||
' Next
|
|
||||||
|
|
||||||
' pdf.Close()
|
|
||||||
' 'For Each page In pages
|
|
||||||
' ' MsgBox("Text found on page: " & page)
|
|
||||||
' 'Next
|
|
||||||
|
|
||||||
|
|
||||||
' Catch ex As Exception
|
Catch ex As Exception
|
||||||
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
' End Try
|
End Try
|
||||||
Case Else
|
Case Else
|
||||||
If dsID > 0 Then
|
If dsID > 0 Then
|
||||||
Me.Cursor = Cursors.WaitCursor
|
Me.Cursor = Cursors.WaitCursor
|
||||||
@@ -1506,6 +1523,7 @@ Public Class frmMDM_USTVAntrag
|
|||||||
End Try
|
End Try
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function getDaID(SchnittstellenNr, reDat, reNr)
|
Private Function getDaID(SchnittstellenNr, reDat, reNr)
|
||||||
Dim da_id = -1
|
Dim da_id = -1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user