PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 10:02 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Web links
PostPosted: Sun Nov 01, 2009 3:02 pm 
Offline

Joined: Sun Nov 01, 2009 2:23 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Web links
PostPosted: Mon Nov 02, 2009 9:38 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Web links
PostPosted: Wed Nov 04, 2009 1:10 pm 
Offline

Joined: Sun Nov 01, 2009 2:23 pm
Posts: 2
Thanks!! I try it with MigraDoc


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 431 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group