CGPDFDictionary keys

僤鯓⒐⒋嵵緔 提交于 2019-12-01 09:37:29

问题


I'm getting crazy, cause I cannot find what are the "default" keys you would have in a PDF Document.

For example, if I want to retrieve an hyperlink from a CGPDFDocument, I do this:

CGPDFStringRef uriStringRef;
if(!CGPDFDictionaryGetString(aDict, "URI", &uriStringRef)) {
    break;
}

In this case, the key is "URI". Is there a document explaining what are the keys of a CGPDFDictionary?


回答1:


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.

To get a list of keys in a CGPDFDictionaryRef you do:

// 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



回答2:


The Adobe PDF Reference describes all of the keys.




回答3:


The keys in a dictionary depend on the actual object the dictionary represents (a page dictionary has other keys than an annotation dictionary). The Adobe PDF reference describes all these objects and their keys.



来源:https://stackoverflow.com/questions/6061310/cgpdfdictionary-keys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!