We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Hyperlink on PDF File

How to creat a Hyperlink on a pdf file

5 Replies

DG Divya G Syncfusion Team November 17, 2009 10:20 AM UTC




PdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
PdfGraphics g = page.Graphics;
string html = "http://www.syncfusion.com";
PdfFont font = new PdfStandardFont
(PdfFontFamily.TimesRoman, 2);
PdfHTMLTextElement richTextElement = new
PdfHTMLTextElement(html, font,
PdfBrushes.Blue);
richTextElement.Draw(g, new RectangleF(150, 70, 160, 50));


CZ Chaouki Zaouia November 18, 2009 01:36 PM UTC

I am using a vb.net, I need to greate a hyperlink to refere on an other page in tha same document (same as Links on adobe). how to?


AD Administrator Syncfusion Team November 23, 2009 10:06 AM UTC

Hi Chaouki,

We can achieve the link within a document using "PdfDocumentLinkAnnotation".

Please do find the sample from the below specified location and let me know if this helps.

http://help.syncfusion.com/support/pdf.Windows/F91398_VB.zip

Regards,
Divya.G


JP Juri Parrinello September 20, 2013 10:24 AM UTC

Hi there,

I am aware that this is an old post but i tried to download the example using the link provided and i received an error because the resource is no longer there.

I am trying to embed a mailto link in my pdf document, the link has the following format:
    '<a rel='nofollow' href="mailto:juri.parrinello@.kpmg.co.uk?Subject=EmailSubject&Body=EmailBody">Add comments</a>'  

To create the PDF document, I use the following code:
            Dim pdfDoc As New PdfDocument
            Dim MyPage As PdfPage = pdfDoc.Pages.Add()
            MyPage.Section.PageSettings.Margins.Top = 10
            MyPage.Section.PageSettings.Margins.Left = 20

            Dim converter As New HtmlConverter
            converter.EnableHyperlinks = True

            converter.AutoDetectPageBreak = True
            Dim result As Image = converter.FromString(htmlData, ImageType.Metafile, 650)
            Dim pdfImage As PdfImage = pdfImage.FromImage(result)
            Dim format As PdfMetafileLayoutFormat = New PdfMetafileLayoutFormat()
            format.Break = PdfLayoutBreakType.FitPage
            format.Layout = PdfLayoutType.Paginate
            format.SplitTextLines = False
            format.SplitImages = False
            pdfImage.Draw(MyPage, PointF.Empty, format)

Yet, when the pdf document is created, the link looks like a proper link Add comments but clicking it does produce the expected result (opening a new mail) - it looks like i am clicking a plain text.

Would someone be able to assist me with my query?

Kind Regards
Juri Parrinello



PH Praveenkumar H Syncfusion Team October 1, 2013 04:00 AM UTC

Hi Juri,

Thank you for using syncfusion products,

We are not able to reproduce the mentioned issue.
Hence we have attached the generated document.
Please provide us more details about the issue.

Please let us know if you need further assistance,

With Regards,
Praveen


Sample_5af69d6e.zip

Loader.
Live Chat Icon For mobile
Up arrow icon