如何使用Excel vba使用Bluebeam Revu 21将合并两个PDF合并

pn9klfpd  于 2023-11-20  发布在  其他
关注(0)|答案(1)|浏览(195)

我曾尝试用Bluebeam在**Excel中以编程方式将两个PDF合并合并。但我面临的问题是“ActiveX组件无法创建对象”。

Dim BluebeamApp As Object
    Dim PDFDocument As Object
    Dim PDFPath1 As String
    Dim PDFPath2 As String

    ' Define the paths to the PDF files you want to combine
    PDFPath1 = "D:\Keylock\keylayout1.pdf"
    PDFPath2 = "D:\Keylock\keylayout1.pdf"

    ' Create a Bluebeam Application object
    Set BluebeamApp = CreateObject("RevuLauncher.Application")

    ' Create a new PDFDocument object
    Set PDFDocument = BluebeamApp.NewDocument

    ' Insert the first PDF file
    PDFDocument.InsertPages PDFPath1, 0, 0, 0, ""

    ' Insert the second PDF file after the first one
    PDFDocument.InsertPages PDFPath2, 1, 0, 0, ""

    ' Save the combined PDF to a new file
    PDFDocument.SaveAs "D:\Keylock\CombinedFile.pdf", False

    ' Close the PDF document
    PDFDocument.Close

    ' Release the Bluebeam objects
    Set PDFDocument = Nothing
    Set BluebeamApp = Nothing`

字符串
错误图像:


的数据
这段代码中缺少了什么?上面的代码必须包含哪个库?

holgip5t

holgip5t1#

使用ghostscript组合合并pdf

Dim inputPDFs As String
    Dim outputPDF As String
    Dim command As String

    ' Set the path to Ghostscript executable
    ghostscriptPath = "C:\Program Files\gs\gs10.01.2\bin\gswin64c.exe"

    ' Set paths for input PDFs and the merged PDF
    inputPDFs = """D:\Keylock\Template2.pdf"" ""D:\Keylock\Template3.pdf"""
    outputPDF = "D:\Keylock\merged.pdf"

    ' Build the Ghostscript command
    command = ghostscriptPath & " -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" & outputPDF & " " & inputPDFs

    ' Execute the Ghostscript command
    Shell command, vbNormalFocus```

字符串

相关问题