Create a table of contents from a pdf file

前端 未结 4 945
不思量自难忘°
不思量自难忘° 2020-12-02 18:02

I\'m using quartz to display pdf content, and I need to create a table of contents to navigate through the pdf. From reading Apple\'s documentation I think I am supposed to

4条回答
  •  不知归路
    2020-12-02 18:32

    You create a Table of Contents (AKA Outlines, Bookmarks) using PDFKit's PDFOutline object. You can also read existing Outlines within a PDF.

    CGPDFDocumentGetCatalog is a method for getting the Catalog of PDF data in the file, which is at a much lower-level than human concepts of 'Contents'.

    In the absence of existing Outlines, I'm not sure there's a way to get meaningful data from the PDF stream itself, e.g. trying to grok Chapter headings just from the PDF data.

提交回复
热议问题