Page 1 of 2

PDFSearchText Feature request

Posted: Thu Jun 30, 2011 10:06 pm
by btesch
What would it take to be able to add "Match Whole Word Only" to the search capabilities?

Re: PDFSearchText Feature request

Posted: Wed Jul 06, 2011 9:07 pm
by btesch
While I am begging. :D What would it take to have a function that can either search backwards, or allow us to get a count of all of the occurances of a searched for item so we can go to the last and work our way backwards with our own code routines?

Re: PDFSearchText Feature request

Posted: Thu Jul 07, 2011 9:37 pm
by Loïc
Hi Bob,

Sorry for the delay. We will investigate your request within few days.

Kind regards,

Loïc

Re: PDFSearchText Feature request

Posted: Mon Jul 18, 2011 10:36 am
by Loïc
The feature has been implemented for GdPicture.NET 8.0.5

Re: PDFSearchText Feature request

Posted: Mon Jul 18, 2011 3:22 pm
by btesch
Will it be both "Match Case" and "backward search"? Also when do you expect 8.0.5 to be out?

Re: PDFSearchText Feature request

Posted: Mon Jul 18, 2011 3:25 pm
by Loïc
Only "Match Case",
for backward search you have all you need to implement it from your application.
The 8.0.5 is available since 2 minutes.

Kind regards,

Loïc

Re: PDFSearchText Feature request

Posted: Mon Jul 18, 2011 3:29 pm
by btesch
Thank you for the match case. I am a little stumped on the backward search. Do you have a snippet/example of implementing that with the tools currently available? Thanks again.

Bob

Re: PDFSearchText Feature request

Posted: Mon Jul 18, 2011 4:52 pm
by Loïc
You can use this function:

Code: Select all

Public Function PdfSearchText(
    ByVal Page As Integer, 
    ByVal Text As String, 
    ByVal Occurrence As Integer, 
    ByVal CaseSensitive As Boolean, 
    ByVal WholeWords As Boolean, 
    ByRef Left As Single, 
    ByRef Top As Single, 
    ByRef Width As Single, 
    ByRef Height As Single
) As Boolean
Occurrence and Page parameters can do the trick.

For example, you can count the number of occurrence on a specific page calling this function until it returns false (don't forget to increment the Occurrence parameter in your loop).
Then, when know how many occurrences are available for a specific text, you can obtain the position of the n occurrence...

It's hard to explain but very easy to implement. Hope my explanation brings some lights.

Kind regards,

Loïc

Re: PDFSearchText Feature request

Posted: Mon Jul 18, 2011 4:56 pm
by btesch
I had though about that one, but was trying not to have an accumulator loop. Your functions are fast enough that I don't think doing the loop will be an issue. Thanks for the info.

Bob

Re: PDFSearchText Feature request

Posted: Mon Jul 18, 2011 4:58 pm
by Loïc
No the loop is not an issue at all.
You can expect faster result than Adobe Acrobat :)

Re: PDFSearchText Feature request

Posted: Mon Aug 15, 2011 11:47 pm
by btesch
Well, I have finally got around to implementing and testing the WholeWord addition to the PDFSearchText function. It appears that all searches are looking for WholeWord, regardless of what is being passed to the funciton. I even tried using the overload that does not include the WholeWord bool and it searches for whole words only. I even installed the latest version (8.1.1) and retested with that one and the results are the same. Any help is appreciated.

Bob

Re: PDFSearchText Feature request

Posted: Mon Aug 15, 2011 11:59 pm
by Loïc
Bob,

To enable whole word option just set the WholeWords parameter to True. To disable the option, turn the parameter to False. There is nothing else to do and this works.

If you still have a problem with this parameter, please attach a document an explain what do you expect for your search.

Kind regards,

Loïc

Re: PDFSearchText Feature request

Posted: Tue Aug 16, 2011 2:58 pm
by btesch
What I expect is quite simple. If I have passed a search text of "co", I expect it to find all instances of the letters "co" that occur on the page. This is not the case. I have words like "corn", "cooperative", "company", & "eco" on the page and it is not finding these, even if I hard code the "WholeWord" parameter to be false. It did find these before the "WholeWord" option was released. The extra finds was the reason I ask for that feature to be added. Please advise.

Bob

Re: PDFSearchText Feature request

Posted: Tue Aug 16, 2011 8:08 pm
by Loïc
Hi Bob,

Please attach the document as example + the code you are using to apply the search. All is working perfectly for me.

Re: PDFSearchText Feature request

Posted: Tue Aug 16, 2011 8:47 pm
by btesch
Attached is the .cs file for our viewer tool that uses GdPicture.