[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Search a text enabled PDF using Visual Foxpro

Posted on 2011-04-25
Medium Priority
Last Modified: 2012-05-11
Is there a way to programatically search a text enabled pdf (or group of PDF's) from within Visual Foxpro?
Question by:HCPCJJ1
LVL 30

Accepted Solution

Olaf Doschke earned 2000 total points
ID: 35468917
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.ConnectionString="Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"

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

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

   lcFilename =  Addbs(loPath.Value)+loFile.Value
   ? lcFilename

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.

Author Comment

ID: 35468964
This is perfect.  Thank you.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is in response to a question here (http://www.experts-exchange.com/Other/URLs/Q_28283850.html) at Experts Exchange. The Original Poster has a scanned signature and wants to make the background transparent so that the signature may be pl…
*Adobe Acrobat 9 was used for this article.  Particular steps may vary depending on software versions. Adobe Acrobat has many, many variables that my be utilized to customize your forms for clarity and ease of use. The Form Editing Tool will be y…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question