Reputation: 811
I am trying to do search functionality in iPhone. I pass the page number and the string to be searched.. but it is not getting the proper output. in contentStream I get nothing. I got this code by googling. I don't know what will be there in contentStream object.
-(BOOL)page:(CGPDFPageRef)inPage containsString:(NSString *)inSearchString {
[self setCurrentData:[NSMutableString string]];
CGPDFContentStreamRef contentStream = CGPDFContentStreamCreateWithPage(inPage);
CGPDFScannerRef scanner = CGPDFScannerCreate(contentStream, table, self);
bool ret = CGPDFScannerScan(scanner);
CGPDFScannerRelease(scanner);
CGPDFContentStreamRelease(contentStream);
return ([[currentData uppercaseString]
rangeOfString:[inSearchString uppercaseString]].location != NSNotFound);
}
If there is any other solution then also it is fine.
Upvotes: 0
Views: 1467
Reputation: 10265
Check out this question and its answers for more information: PDF search on the iPhone
Upvotes: 0
Reputation: 6708
YOU SHOULD IMPLEMENT THE COMPLETE CODE
http://www.random-ideas.net/posts/42%22
check out the above link a complete code to do so.
Upvotes: 2