获取CGPDFDocumentRef文档的名称 [英] Get CGPDFDocumentRef name of document

查看:85
本文介绍了获取CGPDFDocumentRef文档的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从 CGPDFDocumentRef

解决方案

按文档名称,是指文档文件名还是标题?



如果文档title包含在元数据中,它可以是检索如下:

  char * titleKey =Title; 
CGPDFStringRef titleStringRef;

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

printf(title:%s,titleCstring);

其他密钥在PDF 1.7规范的10.2节中列出: Adob​​e PDF参考档案


Is it possible to retrieve the name of a document from a CGPDFDocumentRef

解决方案

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

这篇关于获取CGPDFDocumentRef文档的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆