QuickLook только для внешнего вида.Вы можете получить метаданные из CGPDFDocument
if let url = Bundle.main.url(forResource: "yourFileNameHere", withExtension: "pdf"),
let pdf = CGPDFDocument(url as CFURL) {
let count = pdf.numberOfPages
print(count)
}
. Для docx попробуйте установить ZipZap с carthage: github "pixelglow/ZipZap" "8.1"
NSURL *url = [[NSBundle mainBundle] URLForResource:@"demo" withExtension:@"docx"];
ZZArchive* archive = [ZZArchive archiveWithURL:url error:nil];
NSString *pageCount;
for (ZZArchiveEntry* entry in archive.entries) {
if([entry.fileName isEqualToString:@"docProps/app.xml"]) {
NSString *responseString = [[NSString alloc] initWithData:
[entry newDataWithError:nil] encoding:NSUTF8StringEncoding];
//Get the value between tag <Pages> and </Pages>
NSRange tag1 = [responseString rangeOfString:@"<Pages>"];
NSRange tag2 = [responseString rangeOfString:@"</Pages>"];
pageCount = [responseString substringWithRange:
NSMakeRange((tag1.location + tag1.length), (tag2.location - tag1.length - tag1.location))];
}
}
Вот источник метаданных docx: https://www.forensicswiki.org/wiki/Word_Document_(DOCX)