0

I would like to pick two PDF files from their respective folders and merge them into a single PDF with a designated name in a separate folder.

I have seen multiple VBA code examples based on Adobe Acrobat, but I have Nuance Power PDF Application and I could not find the libraries for that.

I tried the following.

Sub Kofax_Support()

Dim PDFApp As PDFPlus.App
Dim ddDocTarget As PDFPlus.DDDoc
Dim ddDocSource As PDFPlus.DDDoc

Set PDFApp = CreateObject("PowerPDF.App")
Set ddDocTarget = CreateObject("PowerPDF.DDDoc")

If ddDocTarget.Open("C:\Users\rmadamsetty\Desktop\Projects\Sharepoint Returns\Folder 1\Rahul Cowin.pdf") = False Then
    PDFApp.Exit
    Exit Sub
End If
ddDocTarget.Open ("C:\Users\rmadamsetty\Desktop\Projects\Sharepoint Returns\Folder 1\Rahul Cowin.pdf")

Set ddDocSource = CreateObject("PowerPDF.DDDoc")

If ddDocSource.Open("C:\Users\rmadamsetty\Desktop\Projects\Sharepoint Returns\Folder 2\Sub 2\Ravikanth Cowin.pdf") = False Then
    ddDocTarget.Close
    PDFApp.Exit
    Exit Sub
End If

If ddDocTarget.InsertPages(1, ddDocSource, 0, 2, False) = False Then
    ddDocSource.Close
    ddDocTarget.Close
    PDFApp.Exit
    Exit Sub
End If

If ddDocTarget.Save(DDSaveFull, " mydoc.pdf") = False Then
    'Saving the file failed
End If

ddDocSource.Close
ddDocTarget.Close
PDFApp.Exit

End Sub

Kofax Power PDF Advanced: Version: 4.1.0.0.0.21321

Community
  • 1
  • 1
mrk777
  • 117
  • 1
  • 12
  • @KJ, I have tried the above code from that document sample (Page 59). But it is not working and unable to identify where it is going wrong. Can you please help me with the code? – mrk777 Sep 28 '22 at 09:49

0 Answers0