You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kofax Power PDF VBA自动化:正确DLL引用及可用代码方案

补充Nuance Power PDF VBA自动化解决方案
  • 正确的DLL引用路径:C:\Program Files (x86)\Kofax\Power PDF 31\bin\PDFCore8_x64.dll
  • 关键提示:尽管软件名为Power PDF,且官方文档提示使用powerpdf.app创建对象,但实际测试中通过nuancePDF.App和nuancePDF.DVDoc创建对象可正常运行。

可用VBA代码示例

Function copy_pdf_values_with_nuance(path As String) As String
    
    Dim PDFApp As Object
    Dim dvOpenDoc As Object
    Dim ddDoc As Object
    

    Set PDFApp = CreateObject("nuancePDF.App")
    Set dvOpenDoc = CreateObject("nuancePDF.DVDoc")
    
    
    If dvOpenDoc.Open(path) = False Then
        PDFApp.Exit
        Exit Function
    End If
        
    Set ddDoc = dvOpenDoc.GetDDDoc()
    PDFApp.MenuItemExecute ("SelectAll")
    PDFApp.MenuItemExecute ("Copy")
    
    PDFApp.Exit
    
    ' 以下为自定义文本选区的示例代码,如需精准提取特定区域可取消注释使用
    ' Set ddPage = ddDoc.AcquirePage(0)
    ' Set hl = CreateObject("NuancePDF.HiliteList")
    
    ' hr = hl.Add(12, 1)
    ' hr = hl.Add(52, 2)
    ' Set ts = ddPage.CreatePageHilite(hl)
    ' hr = dvOpenDoc.SetTextSelection(ts)
    ' dvOpenDoc.ShowTextSelect

    Dim clipboard As MSForms.DataObject
    Dim strContents As String
    
    Set clipboard = New MSForms.DataObject
    clipboard.GetFromClipboard
    strContents = clipboard.GetText
    
    copy_pdf_values_with_nuance = strContents
End Function

代码说明

这段代码通过启动Nuance PDF应用、打开目标PDF、模拟全选复制操作,最终从剪贴板获取PDF文本内容并返回,可有效解决常见的引用错误问题,实现PDF内容的提取。

内容的提问来源于stack exchange,提问作者Helkowsky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 14:10:34