It's not as easy as it sounds.
Do you want to search just the plain text?
If so, I can suggest a solution:
Visit this site http://text-mining-tool.com/[^] and download that application.
It a program which uses IKVM to run a java PDF library (PDFBox) and which can extract the text from PDF files. For you, the most useful thing will be the command line utility (minetext.exe), which you can call from your code and it will generate a text file with the contents of the PDF. From there you can search all you want.
BTW, all the programs & tools I've mentioned above are free.
It should work pretty well, though I have encountered some PDF files which could not be understand by the PDFBox component, so I couldn't use them.
If the PDF is image based (like a multipage TIFF converted to PDF), then you will need to extract and OCR the individual images. The text data and positional information need to be saved to the cross reference table (I believe).
Once that is done (no small task), then you should be able to use the find function in FoxIt (faster than Adobe) or Adobe reader to locate the text you are trying to find.
If these are text based PDF's (not images) then you should be able to open them up with System.IO.TextReader, notepad, or similar text editing tool and search for the string you are looking for.
I'm reading an excel file, Now the problem is that when reading it make some cells blanks.
THe reason is that if the first column value is of type text ("0.98ad") then it'll show only data like this format
or when it is numeric (0.8) then it shows only numeric values.
i do have a problem, which occours on some machines but not on every machine:
when using the process.start method, it throws the exception the path is invalid.
System.Diagnostics.Process process = Process.Start(startInfo);
the startinfo is
System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();
then I add Arguments (startInfo.Arguments), a FileName (startInfo.Filename), set the UseShellExecute to true (startInfo.UseShellExecute = true) ,set the CreateNoWindow to true (startInfo.CreateNoWindow) to hide the window, then set the RedirectStandardOutput to false during one try and to true in another try (startInfo.RedirectStandardOutput = false or true) and then I reset the UseShellExecute to false (startInfo.UseShellExecute = false).
Finally I invoke the methode but it throws the exception described above.
Does anyone of you have an idea? i checked all the paths and they are correct (meaning those I used during assigning the parameters).
I checked the acrobat path, it is correct. I checked the pdfFileName path, it is correct. I also checked the printername and this is correct as well.
But when starting the process it throws the error message.
What the code does: it prints a pdf file (located on harddisk) using the specified printer.
As I said in my first posting, I tried it on different systems, there are some it works fine (no error message) but there are some which cause this message. And I have no clue why.
the logging works well, so this should not be the problem!
// Add LastName to the above defined paramter @Find
"@Find", // The name of the parameter to map
System.Data.SqlDbType.NVarChar, // SqlDbType values
20, // The width of the parameter
"LastName")); // The name of the source column
// Fill the parameter with the value retrieved
// from the text field
cmd.Parameters["@Find"].Value = txtFind.Text;
// Execute the query
rdr = cmd.ExecuteReader();
// Fill the list box with the values retrieved
lblFound.Items.Add(rdr["FirstName"].ToString() + " " + rdr["LastName"].ToString());
catch (Exception ex)
// Print error message
// Close data reader object and database connection
if (rdr != null)
if (con.State == ConnectionState.Open)
Now things are Better, because Previously you just opened the Connection where you were not supposed to, remember that you have to connect to the Database when you want to execute something. after you are done you close it, and now this function returns a reader, then you can iterate through your records or your can just choose to send the data into the datatable and bind the control.
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding