The following code extracts data from pdf file to text file but only if you have adobe acrobat installed. I need alternate code for this so that if adobe acrobat is not installed, the code should work. Help would highly be appreciated.
Sub convertpdf2()
'convert pdf to text file
Dim AcroXApp As Acrobat.AcroApp
Dim AcroXAVDoc As Acrobat.AcroAVDoc
Dim AcroXPDDoc As Acrobat.AcroPDDoc
Dim Filename As String
Dim jsObj As Object
Dim NewFileName As String
Filename = "C:\Users\Xahid\Desktop\sample\farmers history gradewise.pdf"
NewFileName = "C:\Users\Xahid\Desktop\sample\test.txt"
Set AcroXApp = CreateObject("AcroExch.App")
'AcroXApp.Show
Set AcroXAVDoc = CreateObject("AcroExch.AVDoc")
AcroXAVDoc.Open Filename, "Acrobat"
Set AcroXPDDoc = AcroXAVDoc.GetPDDoc
Set jsObj = AcroXPDDoc.GetJSObject
jsObj.SaveAs NewFileName, "com.adobe.acrobat.plain-text"
AcroXAVDoc.Close False
AcroXApp.Hide
AcroXApp.Exit
'Call copy data from text file to excel
'ReadFileLineByLine
End Sub
Bookmarks