CGPDFDictionary键

S.C*_*.C. 2 pdf quartz-graphics ios4

我变得疯狂,因为我无法找到PDF文档中的"默认"键.

例如,如果我想从CGPDFDocument检索超链接,我这样做:

CGPDFStringRef uriStringRef;
if(!CGPDFDictionaryGetString(aDict, "URI", &uriStringRef)) {
    break;
}
Run Code Online (Sandbox Code Playgroud)

在这种情况下,密钥是"URI".是否有文件解释CGPDFDictionary的键是什么?

Kal*_*lle 12

遗憾的是你必须阅读1300页长的规范才能找到字典包含的密钥,这个字典可以包含任何东西,具体取决于它是什么样的注释.

要获得一个密钥列表CGPDFDictionaryRef:

// temporary C function to print out keys
void printPDFKeys(const char *key, CGPDFObjectRef ob, void *info) { 
    NSLog(@"key = %s", key);
}
Run Code Online (Sandbox Code Playgroud)

在您尝试查看内容的地方:

CGPDFDictionaryRef mysteriousDictionary; // this is your dictionary with keys
CGPDFDictionaryApplyFunction(mysteriousDictionary, printPDFKeys, NULL);
// break on or right after above, and you will have the list of keys NSLogged
Run Code Online (Sandbox Code Playgroud)