How to search PDFs

victor64

Well-known member
Joined
Nov 9, 2008
Messages
60
Programming Experience
Beginner
Hello,

I need help on how to search PDFs in a folder from text entered in a text box, list the PDF file names which contains the text in a list box and click on the filenames from the listbox to open the PDF. Can you please help me with the sample codes or links related to this topic.

Thanks in advance.

Victor
 
Sounds quite possible..

You need to find out how to list files in a given path, example:-

Dim TempFile As IO.FileInfo
Dim CurrentDirectory as string ="C:\myfolder"

Dim FileSearch As New System.IO.DirectoryInfo(CurrentDirectory)
FoundFiles = FileSearch.GetFiles("*.pdf")


'update the list box
ListBox1.Items.Clear()

For Each tempfile In FoundFiles

ListBox1.Items.Add(tempfile.ToString)

Next



That should stick any PDF files found in your listbox.



To launch the reader, you need to lookup how to launch programs from vb.net, hint.. "new process" and "StartInfo". Then lookup the acrobat reader parameters. Optionally you could use "shell".


Hope that helps.

The code above is not tested by the way but should work.
 
Hello,

Thank you for your reply, in the

For Each tempfile In FoundFiles
Next

I need to search for a text enterted in the textbox, if found in the pdf, then I would like to add the filename in my listbox. Do you now the code that would allow me to do that?

Thank You.

Victor
 
Hello,

Thank you for your reply, in the

For Each tempfile In FoundFiles
Next

I need to search for a text enterted in the textbox, if found in the pdf, then I would like to add the filename in my listbox. Do you now the code that would allow me to do that?

Thank You.

Victor


Ah sorry I misundertood what you meant.. :( You actually want to search the contents of the PDF files and then return any files that contain the search string?

I found this on google, CodeProject: Converting PDF to Text in C#. Free source code and programming help, not sure if it has any clues though..
 
Back
Top