Skip to main content
Known Participant
January 31, 2017
Question

Searching comments

Hello,

I am using Acrobat Search plugin HFT functions to search text in the PDF document.

Along with regular text, I also want to search the comments.

In the Edit->Advanced Search panel, there is a option to include the comments in the Search.

I just want to do it programmatically.

Here is my code snippet:

ASText searchKey = ASTextNew();

searchKey = ASTextFromEncoded(searchText, kUTF8);

SearchQueryDataRec srcQuery;

memset(&srcQuery, 0, sizeof (SearchQueryDataRec));

srcQuery.size = sizeof(SearchQueryDataRec);

srcQuery.query = searchKey;

srcQuery.type = kSearchActiveDoc;

srcQuery.scope = kSearchDocumentText | kSearchEveryWhere;

srcQuery.path = NULL;

srcQuery.fs = NULL;

srcQuery.maxDocs = 1;

ASBool ret = SearchExecuteQueryEx(&srcQuery);

As you can see, I used srcQuery.scope = kSearchDocumentText | kSearchEveryWhere;

But I am not able to search through comments. But sometimes it gives me an  error like "There was an error retrieving text".

What is it that I am missing here?

Thanks

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Known Participant
February 1, 2017

Any updates on this please?

Translate
Legend
February 1, 2017

You are not being lucky with this API. It is very old and little used. I can't remember another user of it in 20 years. If you want to pursue it I suggest buying a support case.

But I notice you're just using the current document option. Do you really need the search plug-in at all? I suggest...why not just find text the same way as everyone else, by using the PDWordFinder and analysing the words returned...

Translate
Known Participant
February 2, 2017

Hello,

I managed to resolve it by:

srcQuery.scope = kSearchDocumentText | kSearchMarkup;

Thank you for your help!

Translate