Using PdfSharp, I can create an intra-document link and make it clickable using the following code:
Code:
private void AddPageLink(PdfPage page, XGraphics gfx, XFont font, double x, double y, String text, int dest)
{
//XRect link = new XRect(new PdfSharp.Drawing.XPoint(20, 50), new PdfSharp.Drawing.XPoint(200, 200));
//PdfRectangle lin = new PdfRectangle(link);
double lineSpace = font.GetHeight();
int cellSpace = font.FontFamily.GetLineSpacing(font.Style);
int cellAscent = font.FontFamily.GetCellAscent(font.Style);
int cellDescent = font.FontFamily.GetCellDescent(font.Style);
double cyAscent = lineSpace * cellAscent / cellSpace;
XRect rect = gfx.Transformer.WorldToDefaultPage(new XRect(new XPoint(x, y), gfx.MeasureString(text, font)));
rect.Offset(0, cyAscent);
page.AddDocumentLink(new PdfRectangle(rect), dest);
gfx.DrawString(text, font, XBrushes.Blue, x, y, XStringFormats.Default);
}
When I open the resulting PDF file, I can click the links that I added and jump around within the same document.
How would I do the same with MigraDoc? I've searched and can't find the example that I am looking for.
Thanks in Advance,
Rick