Free Support Forum - aspose.com

Mail Merge HTML & Convert Save As Word Document to PDF using C# .NET - Make Links Active in Adobe Reader 9 Reader X

Hi

I have used Words mailmerge to create a document a then save that as PDF format.

The document contains a number of hyperlinks that I am inserting using the code below- which I got from the forums. This works well in Adobe Reader 9. But in Adobe X the link is not active, even though the formatting etc is preserved.
Urls are active as hyperlinks in the pdf eg (www.somewhere.com) but I believe this is due to the setting in adobe rather than in the PDF.

Is there a problem with Words?
Does the hyperlink need to be created differently?

Thanks in advance

Hyperlink Inserting Code from a FormattedMergeFieldHandler:

public void FieldMerging(FieldMergingArgs args)
{
    // All merge fields that expect HTML data should be marked with some prefix, e.g. ‘html’.
    if (args.DocumentFieldName.EndsWith(HtmlMergeFieldSuffix))
    {
        // Insert the text for this merge field as HTML data, using DocumentBuilder.
        var builder = new DocumentBuilder(args.Document);
        builder.MoveToMergeField(args.DocumentFieldName);

        //If no value specified for the field, then do not attempt to set the html
        if (null != args.FieldValue)
        {
            builder.InsertHtml((string)args.FieldValue);
        }

        // The HTML text itself should not be inserted.
        // We have already inserted it as an HTML.
        args.Text = "";
    }
}

Hello

Thanks for your request. I think you can try using InsertHyperlink method to insert a hyperlink into the document. Please see the following link learn more:

Best regards,