iTextSharp Use Link Inside PdfPCell
- by Baxter
I am able to successfully put a link in the pdf with a friendly name:
Anchor anchor = new Anchor("Google", linkFont);
anchor.Reference = "https://www.google.com";
doc.Add(anchor);
However, I cannot get get the anchor to work within a PdfPCell.
Here is what I have tried so far:
var memberCell = new PdfPCell();
Anchor anchor = new Anchor("Google", linkFont);
anchor.Reference = "https://www.google.com";
memberCell.AddElement(new Anchor(anchor));
That displays the exception: System.ArgumentException: Element not allowed.
I also tried:
var memberCell = new PdfPCell();
Anchor anchor = new Anchor("Google", linkFont);
anchor.Reference = "https://www.google.com";
memberCell.AddElement(new Phrase(anchor));
This does not throw an exception but it isn't a link it is just the word "Google".
I am using the newest version of iTextSharp at this time v.(5.4.4.0)
Any help on this would be greatly appreciated.