我尝试扩展(我是 Objective-C 的初学者)一个带有 PDF 包含大纲的 pdf 查看器。查看器基于 Apple 的 PDFKit。(https://developer.apple.com/documentation/pdfkit/pdfoutline)
这就是我到目前为止所做的:
PDFPage *page = [_pdfDocument pageAtIndex:_pdfDocument.pageCount-1];
PDFOutline *pdfOutline = [_pdfDocument outlineRoot];
NSLog(@"LOG of pdfOutline");
NSLog(@"%@", pdfOutline);
NSLog(@"%i", pdfOutline.numberOfChildren);
那给了我以下输出:
[3685:9776989] LOG of pdfOutline
[3685:9776989] <PDFOutline: 0x60c000203370>
[3685:9776989] 4
到目前为止一切都很好,但我需要 jsonObject 中的标签和页码(这是稍后在 react-native 回调中使用它的必要原因)。我什至不确定“pdfOutline”的输出是什么。
我真的不知道如何开始。目标很明确,从轮廓生成一个 json-object。