-1

Hi i have a pdf file (path) and I want to convert it to a excel file. im using foxit phantom. I've used the api manual for ref and i cant figure it out. (http://cdn01.foxitsoftware.com/pub/foxit/manual/phantom/en_us/API%20Reference%20for%20Application%20Communication.pdf) The file is just a pdf with random values. I have the library 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, 1, True)

End Sub
Pierre
  • 1
  • 3
  • What happens when you run this? – Tim Williams Jan 11 '21 at 18:22
  • it doesnt recognize the function OCRAndExportToExcel – Pierre Jan 11 '21 at 18:34
  • What is `phApp.CurrentDocument` here? It doesn't look like you've opened any document. The command `OCRAndExportToExcel` ls supposed to be run on an already-opened document. `path` is supposed to be the path where you want to put the *Excel* file created during the process. http://cdn01.foxitsoftware.com/pub/foxit/manual/phantom/en_us/API%20Reference%20for%20Application%20Communication.pdf – Tim Williams Jan 11 '21 at 19:14

1 Answers1

0
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, 1, True, True

End Sub
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77