http://stackoverflow.com/questions/4732386/how-to-find-the-total-number-of-pages-in-pdf-file-loaded-in-objective-c
NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"alice.pdf" withExtension:nil]; CGPDFDocumentRef pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL); int pageCount = CGPDFDocumentGetNumberOfPages(pdf);
NSString *pathToPdfDoc = [[NSBundle mainBundle] pathForResource:@"mypdf" ofType:@"pdf"];
NSURL *pdfUrl = [NSURL fileURLWithPath:pathToPdfDoc];
CGPDFDocumentRef document = CGPDFDocumentCreateWithURL((CFURLRef)pdfUrl);
size_t pageCount = CGPDFDocumentGetNumberOfPages(document);
本文详细介绍了如何使用Objective-C编程语言,通过加载PDF文件并使用CGPDFDocument接口来获取PDF文件的总页数,提供了解决实际问题的实用技巧。
903

被折叠的 条评论
为什么被折叠?



