Copy Table of Contents from one PDF to another

痴心易碎 提交于 2019-12-06 19:33:19

问题


You might find it as duplicate of this Question, but I didnt get any solution there. My scenario is like I am creating a PDF from existing PDF with some edits. That all works fine. My question is I want to add metadata, table of contents, bookmarks, what ever you call that is in metadata of PDF to newly created PDF. I am not able to understand XMP format as suggested here. Is there any way I can directly add TOC to new PDF. I am using following function but it is not working at all.

CGPDFContextAddDocumentMetadata(pdfContext, contdata);

Can any one suggest me right direction to dig in. Any 3rd party tool will also do. I tried podofo but I m not getting any way for porting it in ios.


回答1:


The XMP metadata and TOC/bookmarks are 2 different things. While the TOC in a PDF file can be read using the CGPDF* functions, it cannot be duplicated in another PDF file because the CGPDF* API does not let you create PDF objects and insert them in a PDF file.




回答2:


I recently did a lot of merging pdf's together and also populating form data. I would check out PDF Toolkit as it really helped me out. You can execute it from within your code.



来源:https://stackoverflow.com/questions/8122166/copy-table-of-contents-from-one-pdf-to-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!