问题描述
我变得疯狂,因为我无法找到PDF文档中的默认键。
I'm getting crazy, cause I cannot find what are the "default" keys you would have in a PDF Document.
例如,如果我想要从CGPDFDocument中检索超链接,我这样做:
For example, if I want to retrieve an hyperlink from a CGPDFDocument, I do this:
CGPDFStringRef uriStringRef;
if(!CGPDFDictionaryGetString(aDict, "URI", &uriStringRef)) {
break;
}
在这种情况下,键是URI。有没有一个文件解释CGPDFDictionary的键是什么?
In this case, the key is "URI". Is there a document explaining what are the keys of a CGPDFDictionary?
推荐答案
你需要阅读1300页长是荒谬的specs只是为了找到字典包含的键,一个可以包含任何内容的字典,具体取决于它是什么类型的注释。
It's absurd that you would have to go read 1300 page long specs just to find what keys a dictionary contains, a dictionary that could contain anything depending on what kind of annotation it is.
获取<$中的键列表c $ c> CGPDFDictionaryRef 你这样做:
// temporary C function to print out keys
void printPDFKeys(const char *key, CGPDFObjectRef ob, void *info) {
NSLog(@"key = %s", key);
}
在您试图查看内容的地方:
In the place where you're trying to see the contents:
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
这篇关于CGPDFDictionary键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!