Get CGPDFDocumentRef name of document

落花浮王杯 提交于 2019-12-03 15:45:48

By "name of a document", do you mean the document filename or title?

If the document "title" is included in the metadata it can be retrieved like this:

    char *titleKey = "Title";
    CGPDFStringRef titleStringRef;

    CGPDFDictionaryRef info = CGPDFDocumentGetInfo(myDocumentRef);
    CGPDFDictionaryGetString(info, titleKey, &titleStringRef);
    const unsigned char *titleCstring = CGPDFStringGetBytePtr(titleStringRef);

    printf("title: %s", titleCstring);

The other keys are listed in section 10.2 of the PDF 1.7 specification: Adobe PDF Reference Archives

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