FoxitPhantom pdf 转 Excel 自动化

问题描述

您好,我有一个 pdf 文件(路径),我想将其转换为 excel 文件。我用的是福昕幻影。我已经将 api 手册用于 ref,但我无法弄清楚。 (http://cdn01.foxitsoftware.com/pub/foxit/manual/phantom/en_us/API%20Reference%20for%20Application%20Communication.pdf) 该文件只是一个带有随机值的 pdf。我有图书馆 PhantomPDF

Sub convert()

Dim phApp As PhantomPDF.Application
Set phApp = CreateObject("PhantomPDF.Application")
Dim phCreator As PhantomPDF.Document
Set phCreator = phApp.CurrentDocument
Dim hresult As Variant
Dim path As String
path = "C:\Users\plfournier\Documents\test.pdf"

hresult = phCreator.OCRAndExportToExcel(path,1,True)

End Sub

解决方法

Sub convert()

    Dim phApp As PhantomPDF.Application

    Dim phCreator As PhantomPDF.Document
    Dim hresult As Variant
    Dim path As String

    Set phApp = CreateObject("PhantomPDF.Application")
    Set phCreator = phApp.CurrentDocument
    path = "C:\Users\39340\Downloads\90-21 DN16 CONTACT.xls"

    phCreator.OCRAndExportToExcel path,1,True,True

End Sub