Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get page number from destination string while pdf parsing in iphone
    primarykey
    data
    text
    <p>I am using the following code. it always gets into the destination string if. it does not go to get page number loop. if pdf found destination string then it will not go to else part. so how can i get the page number from destination string. You can see an example of the code below. Thanks in advance.</p> <pre><code>- (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", &amp;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", &amp;nextDic)) { [self recursiveUpdateOutlines:nextDic parent:parentItem level: level]; } } // First child CGPDFDictionaryRef firstDic; if (CGPDFDictionaryGetDictionary(outlineDic, "First", &amp;firstDic)) { [self recursiveUpdateOutlines:firstDic parent:item level: level + 1]; } // Dest CGPDFStringRef destString; if(CGPDFDictionaryGetString(outlineDic, "Dest", &amp;destString)) { const char* pchDest = CGPDFStringGetBytePtr(destString); CGPDFDictionaryRef destDic; if(CGPDFDictionaryGetDictionary(dests, pchDest, &amp;destDic)) { NSLog(@""); } else { item.destString = [NSString stringWithUTF8String:pchDest]; } } else { CGPDFDictionaryRef ADic; if (CGPDFDictionaryGetDictionary(outlineDic, "A", &amp;ADic)) { const char* pchS; if (CGPDFDictionaryGetName(ADic, "S", &amp;pchS)) { CGPDFArrayRef destArray; if (CGPDFDictionaryGetArray(ADic, "D", &amp;destArray)) { int count = CGPDFArrayGetCount(destArray); switch (count) { case 5: { // dest page CGPDFDictionaryRef destPageDic; if (CGPDFArrayGetDictionary(destArray, 0, &amp;destPageDic)) { int pageNumber = [self.pages indexOfObjectIdenticalTo:destPageDic]; item.page = pageNumber; } // x CGPDFInteger x; if (CGPDFArrayGetInteger(destArray, 2, &amp;x)) { item.x = x; } // y CGPDFInteger y; if (CGPDFArrayGetInteger(destArray, 3, &amp;y)) { item.y = y; } // z } break; default: NSLog(@""); break; } } } } } return item; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload