PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Web links
http://forum.pdfsharp.com/viewtopic.php?f=2&t=921
Page 1 of 1

Author:  thehitchhiker [ Sun Nov 01, 2009 3:02 pm ]
Post subject:  Web links

Hi,

I'm trying to add a couple of web links to my pdf with PdfSharp. But only one link appears in the document.
Furthermore it appears at a completely different position.

Code:
XGraphics gfx       = XGraphics.FromPdfPage(this._Page);
XFont font                    = new XFont("Verdana", 10);
XStringFormat format     = new XStringFormat();
XTextFormatter tf         = new XTextFormatter(gfx);
         

XRect Text = new XRect (20, this._Offset+100, 100, 100);
tf.Alignment = XParagraphAlignment.Left;
tf.DrawString("appointment", font, XBrushes.Black, Text, XStringFormats.TopLeft);

// I try to set the web link at the same position like the string "appointment"
XRect rec = new XRect (20, this._Offset+100, 20, 12);
PdfRectangle Pdfrec = new PdfRectangle (rec);

// google is just a test link   
gfx.PdfPage.AddWebLink(Pdfrec, "http://www.google.de");
gfx.Dispose ();


Has somebody an idea to set more than one link in the document?

Thanks

Author:  Thomas Hoevel [ Mon Nov 02, 2009 9:38 am ]
Post subject:  Re: Web links

You set a large rectangle for the text and a small rectangle for the hyperlink (the clickable area).

MigraDoc uses the same functions to create hyperlinks - and MigraDoc can have several hyperlinks on one page, the clickable areas are correct and the hyperlinks work.

Author:  thehitchhiker [ Wed Nov 04, 2009 1:10 pm ]
Post subject:  Re: Web links

Thanks!! I try it with MigraDoc

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/