Merge oder Combine PDF Files VBA Vb.net

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von petaod.

    Merge oder Combine PDF Files VBA Vb.net

    Hallo, ich brauche dringend Hilfe..

    Ich bin dabei mein VBA Code in Vb.net zu konvertieren.

    Dabei bekomme ich bei der Erstellung bzw Mergen von PDF Dateien Probleme..

    Folgenden Code kann ich fehlerfrei über VBA ausführen. Vielleicht hat hier ja jmd. ein Vorschlag, wie ich dieses Modul über vb.net erstellen kann..

    Danke!!


    VB.NET-Quellcode

    1. Sub MergeAllExt()
    2. Dim objCAcroPDDocDestination As Acrobat.CAcroPDDoc
    3. Dim objCAcroPDDocSource As Acrobat.CAcroPDDoc
    4. Set objCAcroPDDocDestination = CreateObject("AcroExch.PDDoc")
    5. Set objCAcroPDDocSource = CreateObject("AcroExch.PDDoc")
    6. Dim OrdnerDestination(0 To 17) As String
    7. OrdnerDestination(0) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Grundformen.pdf"
    8. OrdnerDestination(1) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Vollpappe.pdf"
    9. OrdnerDestination(2) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Wellpappe.pdf"
    10. OrdnerDestination(3) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Versand.pdf"
    11. OrdnerDestination(4) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Polster.pdf"
    12. OrdnerDestination(5) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Display.pdf"
    13. OrdnerDestination(6) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Kreativ.pdf"
    14. OrdnerDestination(7) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Stuetzen.pdf"
    15. OrdnerDestination(8) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Stege.pdf"
    16. OrdnerDestination(9) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_a1.pdf"
    17. OrdnerDestination(10) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_a2.pdf"
    18. OrdnerDestination(11) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_b.pdf"
    19. OrdnerDestination(12) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_c.pdf"
    20. OrdnerDestination(13) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_d.pdf"
    21. OrdnerDestination(14) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_e.pdf"
    22. OrdnerDestination(15) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_f.pdf"
    23. OrdnerDestination(16) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Ecma_x.pdf"
    24. OrdnerDestination(17) = "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\StandardTemp.pdf\Fefco.pdf"
    25. objCAcroPDDocDestination.Open OrdnerDestination(0)
    26. Dim tt As Integer
    27. For tt = 1 To 17
    28. objCAcroPDDocSource.Open OrdnerDestination(tt)
    29. If objCAcroPDDocDestination.InsertPages(objCAcroPDDocDestination.GetNumPages - 1, objCAcroPDDocSource, 0, objCAcroPDDocSource.GetNumPages, 0) Then
    30. Else
    31. MsgBox (OrdnerDestination(tt) & " nicht gefunden")
    32. End If
    33. objCAcroPDDocSource.Close
    34. Next tt
    35. objCAcroPDDocDestination.Save 1, "\\ERPA-SERVER\ERPA-Updates\ERPA-Standards\KatalogDE\Rohversion.pdf"
    36. objCAcroPDDocDestination.Close
    37. Set objCAcroPDDocSource = Nothing
    38. Set objCAcroPDDocDestination = Nothing
    39. 'MsgBox "Documents Merged!"
    40. End Sub


    *Topic verschoben*

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Marcus Gräfe“ ()

    Ich arbeite in VBA auch häufig mit dem Acrobat.
    Aber in .Net bin ich komplett auf iTextSharp umgestiegen.
    Insbesondere für so einfache Dinge wie Merge, bietet sich das an, weil auf dem Zielrechner nicht unbedingt ein Acrobat verfügbar sein muss.

    Für das Mergen werden hier einige Ansätze diskutiert:
    stackoverflow.com/questions/60…using-itextsharp-in-c-net

    Das ist zwar C#, kann aber mittels Snippet-Converter problemlos auch in VB.Net portiert werden.
    --
    If Not Program.isWorking Then Code.Debug Else Code.DoNotTouch
    --