Merge 2 PDFs into 1 using Kofax Power PDF Advanced Application

Viewed 43

I have 2 PDF files and I would like to pick them from the respective folders and merge them into a single PDF with a designated name in a separate folder. I have seen multiple VBA codes which are developed based on Adobe Acrobat, but I have Nuance Power PDF Application and I could not find the libraries for that. I have tried the following code, but that is not working.

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

Appreciate your help in advance. Thank you!!

0 Answers
Related