我使用以下代码.它始终进入目标字符串if.它不会去获取页码循环.如果pdf找到目标字符串,那么它将不会转到其他部分.那么如何从目标字符串中获取页码.您可以在下面看到代码示例.提前致谢.
- (OutlineItem*)recursiveUpdateOutlines: (CGPDFDictionaryRef) outlineDic parent:(OutlineItem*) parentItem level:(NSUInteger) level;
{
// update outline count
outlineCount++;
OutlineItem* item = [[OutlineItem alloc] init];
// Level
item.level = level;
// Title
CGPDFStringRef title;
if(CGPDFDictionaryGetString(outlineDic, "Title", &title)) {
const char* pchTitle = CGPDFStringGetBytePtr(title);
item.title = [NSString stringWithUTF8String:pchTitle];
// DEBUG
//NSLog(item.title);
}
if (parentItem != nil) {
// Add to parent
[parentItem.children addObject:item];
// Next
CGPDFDictionaryRef nextDic;
if (CGPDFDictionaryGetDictionary(outlineDic, "Next", &nextDic)) {
[self recursiveUpdateOutlines:nextDic parent:parentItem level: level];
}
}
// First child
CGPDFDictionaryRef firstDic;
if …Run Code Online (Sandbox Code Playgroud) NSString * strSearchSql = [NSString stringWithFormat:@"SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '\%%@\%'",strSearchString];
Run Code Online (Sandbox Code Playgroud)
在此查询中,我得到了如下所示的字符串
SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '%@'
Run Code Online (Sandbox Code Playgroud)
我想要这样
SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '%searchtext%'
Run Code Online (Sandbox Code Playgroud)
请给我提示或提供一份文件.