简体   繁体   English

PDFsharp - 目录 - C#

[英]PDFsharp - Table Of Contents - C#

I'm using PDFsharp to create a PDF file, I'm now about to generate a Table Of Contents.我正在使用 PDFsharp 创建一个 PDF 文件,我现在要生成一个目录。 How can I set the dot between the text dynamically?如何动态设置文本之间的点?

I'm using XRect and a XGraphics Object to draw the String.我正在使用 XRect 和一个 XGraphics 对象来绘制字符串。

And set the Link with AddDocumentLink() eg:并使用 AddDocumentLink() 设置链接,例如:

Text..................... 1

Text2.................... 2

Chapter4 ................ 10

You can use DrawString to draw the dots.您可以使用DrawString绘制点。 You can use MeasureString to find out how many dots will fit.您可以使用MeasureString找出适合的点数。

PDFsharp was created for use with MigraDoc. PDFsharp 是为与 MigraDoc 一起使用而创建的。 And MigraDoc makes the creation of a ToC quite simple: MigraDoc 使 ToC 的创建变得非常简单:
http://www.pdfsharp.net/wiki/HelloMigraDoc-sample.ashx http://www.pdfsharp.net/wiki/HelloMigraDoc-sample.ashx
I mention this just in case that switching to a related library is an option.我提到这一点是为了以防万一切换到相关库是一种选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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