How to add DocumentLink to existing PDF file using PdfSharp

醉酒当歌 提交于 2021-01-29 11:13:22

问题


I have several pdf files. and I want to combine all of them in one which I can do using PDFSharp.

But I also want Table Of Contents at the top with DocumentLink.

Table of content is separately created using Migradoc which looks as below.

My question is is there any way in pdfsharp using which I can add Document link on the Document name like Document1, Document2 which redirects to respective pages.


回答1:


Mixing MigraDoc and PDFsharp you can get it done.

You can add a Tag to the paragraphs that you want to link. While the created PDF and the MigraDoc document are still open, you can combine the PDFs and add the links. In PDFsharp you specify the rectangle you want to turn into a link. If you want a special look for the links, you have to set the look in MigraDoc already.

Finding the tagged paragraphs in the document to add the links is tricky and I don't have a sample at hand.
Here is code that adds the pages one by one: https://forum.pdfsharp.net/viewtopic.php?f=8&t=3172
Add the links after adding each MigraDoc page with the table of contents. See this post on the PDFsharp forum to get started:
https://forum.pdfsharp.net/viewtopic.php?p=9694#p9694



来源:https://stackoverflow.com/questions/65607056/how-to-add-documentlink-to-existing-pdf-file-using-pdfsharp

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