简体   繁体   中英

iOS QuickLook QLPreviewController can it display page number of DOC file

When viewing a PDF file, QuickView can show the individual pages. Can this be done with MS Office files too (DOC, PPT)? I want a way to know how many pages/slides are in the document and what page I am currently viewing.

Thanks for the help!

The result of CGPDFDocumentGetPage is the same as an indirect page reference you get when resolving a destination in an outline item. Both are essentially dictionaries and you can compare them using == . When you have a CGPDFDictionaryRef that you want to know the page number of, You can do something like this:

CGPDFDocumentRef doc = ...;
CGPDFDictionaryRef outlinePageRef = ...;
for (int p=1; p<=CGPDFDocumentGetNumberOfPages(doc); p++) {
  CGPDFPageRef page = CGPDFDocumentGetPage(doc, p);
  if (page == outlinePageRef) {
    printf("found the page number: %i", p);
    break;
  }
}

An explicit destination however is not a page, But an array with the first element being the page. The other elements are the scroll position on the page etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM