I have implemented the following recursive method for reaching the outlines:
- (void)loadAllSubChapters:(PDFOutline*)outline {
if (outline == nil) {
return;
}
if (![self.contentLabels containsObject:outline.label]) {
[self.contentLabels addObject:outline.label];
}
PDFOutline *parent = outline;
PDFOutline *child = outline.child;
PDFOutline *sibling = outline.next;
[self loadAllSubChapters:child];
[self loadAllSubChapters:sibling];
}
I have a big pdf file that contains a lot of chapters and subchapters, going two/three levels into depth... To make it more clear here is an example of a
main chapter (i.e. it has no parent chapter) containing some subchapters:
<chapter - level 0>
- <subchapter A - level 1>
- <subchapter A1 - level 2>
- </subchapter A1 - level 2>
- </subchapter A - level 1>
- <subchapter B - level 1>
- <subchapter B1 - level 2>
- <subchapter B1.1 - level 3>
- </subchapter B1.2 - level3>
- </subchapter B1 - level 2>
- </subchapter B - level 1>
</chapter - level0>
When I call the loadAllSubChapters: starting with rootOutline (called over PDFDoc's object) I get only chapter titles from levels 0 and 1, which means that all children from chapters from level 1 are nil...
I am really interested why is that so? Could you please tell me what does PDFOutline object really represent?