Search a text enabled PDF using Visual Foxpro

Posted on 2011-04-25
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 29

    Accepted Solution

    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

    Bye, Olaf.

    Bye, Olaf.

    Author Comment

    This is perfect.  Thank you.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe A recent question here at Experts Exchange piqued my interest, so I decided to provide a thorough solution and publ…
    *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 first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now