Search a text enabled PDF using Visual Foxpro

Is there a way to programatically search a text enabled pdf (or group of PDF's) from within Visual Foxpro?
HCPCJJ1Asked:
Who is Participating?
 
Olaf DoschkeConnect With a Mentor Software DeveloperCommented:
No and yes. You need some third party tool to extract the text out of the pdf or search within a pdf, this is not natively built into VFP (but then where is it?).

Windows Search supports searching within PDFs, when a PDF IFilter, such as the Adobe Acrobat Reader or Foxit PDF IFilter, is installed. then you can find PDF files via Windows Search, which you can utilize programmatically from VFP.

Needing Vista or higher:
loConn=CREATEOBJECT("adodb.connection")
loConn.ConnectionString="Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
loConn.Open()

Text To lcWSSQL NoShow
SELECT System.ItemFolderPathDisplay, System.Filename 
FROM SystemIndex 
WHERE CONTAINS('searchstring') AND System.FileExtension = '.pdf' 
Endtext

loRs = loConn.Execute(lcWSSQL)
loRS.Movefirst()
Do While Not loRS.EOF
   loPath = loRs.Fields.Item("System.ItemFolderPathDisplay")
   loFile = loRs.Fields.Item("System.Filename")

   lcFilename =  Addbs(loPath.Value)+loFile.Value
   ? lcFilename
   loRS.Movenext()
EndDo

Open in new window


More about Windows Search SQL Syntax at http://msdn.microsoft.com/en-us/library/bb266512%28VS.85%29.aspx

Bye, Olaf.

Bye, Olaf.
0
 
HCPCJJ1Author Commented:
This is perfect.  Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.