VBA, Combine PDFs into one PDF file

前端 未结 4 1241
温柔的废话
温柔的废话 2020-12-03 08:14

I am trying to combine PDF\'s into one single pdf with the use of vba. I would like to not use a plug in tool and have tried with acrobat api below.

I have tried som

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 08:48

    I don't have a exact soluation for your problem, however, I had a similar one, namely that I wanted to add fields to a pdf from VBA.

    I can tell you that Adobe has a JavaScript API which you can control through vba.

    Here is the link to the API https://www.adobe.com/devnet/acrobat/javascript.html

    And this is a part of the code I used in VBA to control fields in the PDFs.

    Set app = CreateObject("Acroexch.app")
    app.Show
    Set AVDoc = CreateObject("AcroExch.AVDoc")
    Set AForm = CreateObject("AFormAut.App") 'from AFormAPI
    AVDoc.Open(pathsdf, "")
    
    Ex = "Put your JavaScript Code here"
    
    AForm.Fields.ExecuteThisJavaScript Ex
    

    You should probably look at the insertPages method in the API.

    What is als possible is using the build in reference from VBA to Acrobat. However, I found it very limited and I did not work with it. There are only a few objects available, here are some examples:

    Dim AcroApp As Acrobat.AcroApp
    Dim objAcroAVDoc As New Acrobat.AcroAVDoc
    Dim objAcroPDDoc As Acrobat.AcroPDDoc
    Dim objAcroPDPage As Acrobat.AcroPDPage
    Dim annot As Acrobat.AcroPDAnnot
    

提交回复
热议问题