tags:

views:

40

answers:

0

We use the Acrobat SDK (Interop.Acrobat.dll) to merge PDF's in a directory, and we want to alter the header to allow us to put a page number on each page once the merge has taken place.

It's a long function, so I'm leaving only the important stuff...

Function MergePDF(ByVal Path As String, ByVal outFileName As String, ByVal DeleteOrginal As Boolean) As String
    Dim dPDDocMerge As New Acrobat.AcroPDDoc
    Dim dPDDoc As New Acrobat.AcroPDDoc

    dPDDocMerge = New Acrobat.AcroPDDoc
    dPDDocMerge.Open(strFiles(1)) // open first file
    dPDDoc = New Acrobat.AcroPDDoc
    dPDDoc.Open(strFiles(2)) // open other files
    dPDDocMerge.InsertPages(numPage - 1, dPDDoc, 0, dPDDoc.GetNumPages, False) // Insert
    dPDDoc.Close

    // This looks like it should work, but setPageLabels returns an invalid argument type
    Dim jso As Object
    jso = dPDDocMerge.GetJSObject()
    jso.setPageLabels(0, "D", "", 1) // I get an error saying "TypeError: Invalid argument type."

    dPDDocMerge.Save(1, Path & "\\" & finalFileName) // save file
    dPDDocMerge.Close()
End Function