【发布时间】:2013-11-18 07:58:54
【问题描述】:
我能够成功地在 pdf 中添加一个友好名称的链接:
Anchor anchor = new Anchor("Google", linkFont);
anchor.Reference = "https://www.google.com";
doc.Add(anchor);
但是,我无法让锚点在 PdfPCell 中工作。
到目前为止,这是我尝试过的:
var memberCell = new PdfPCell();
Anchor anchor = new Anchor("Google", linkFont);
anchor.Reference = "https://www.google.com";
memberCell.AddElement(new Anchor(anchor));
显示异常:System.ArgumentException: Element not allowed.
我也试过了:
var memberCell = new PdfPCell();
Anchor anchor = new Anchor("Google", linkFont);
anchor.Reference = "https://www.google.com";
memberCell.AddElement(new Phrase(anchor));
这不会引发异常,但它不是链接,它只是“Google”这个词。
我目前正在使用最新版本的 iTextSharp v.(5.4.4.0)
对此的任何帮助将不胜感激。
【问题讨论】:
标签: pdf hyperlink anchor itextsharp cell