【问题标题】:objective-c, getting the number of pages of a pdf documentObjective-c,获取一个pdf文档的页数
【发布时间】:2014-01-21 18:10:13
【问题描述】:

这可能是一个愚蠢的问题,但请帮助我。我只想知道如何提取保存在问题contentURL(报亭框架)上的 PDF 文档的页数。以必须有效的方式,因为我只想正确编号一些我也保存在contentURL 中的页面。换句话说:不打开pdf是否可以知道它的页数?

【问题讨论】:

    标签: ios pdf nsfilemanager newsstand-kit


    【解决方案1】:

    看看这个:https://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CGPDFDocument/Reference/reference.html

    有这个方法:

    size_t CGPDFDocumentGetNumberOfPages(CGPDFDocumentRef document)
    

    这会给你页数。

    这样实现:

    NSURL *pdfUrl = [NSURL fileURLWithPath:yourPath];    
    CGPDFDocumentRef document = CGPDFDocumentCreateWithURL((CFURLRef)pdfUrl);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-23
      • 2015-04-19
      • 2019-06-07
      相关资源
      最近更新 更多