Hyperlinks not appearing in Google Chrome

We are doing a Word Merge and embedding lots of Hyperlinks to external sites. The document is then converted into a PDF.

If we open the PDF in Google Chromes inbuilt PDF viewer most of the hyperlinks do not display. However, if we save to a docx then use Word to manually convert to a PDF the links appear in Google Chrome. The links always work in Adobe Reader.

Does anyone know how to fix this?

We are using:

builder.MoveToMergeField(args.FieldName);
builder.Font.StyleIdentifier = StyleIdentifier.Hyperlink;
builder.InsertHyperlink(text, url, false);
builder.InsertField($"XE \"{entry}\"");

Hi Andrew,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Pdf that shows the undesired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Sorry it took me a while to get this. I have tested it with Aspose.Words 17.3. If you open the output.docx file and use Word 2016 to convert it to a PDF then the links open correctly in Chrome PDF viewer. If you open the generated PDF file they don’t appear as links.

Hi Andrew,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15168. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Andrew,

Thanks for your patience. It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-15168) as ‘Not a Bug’.

Please set the value of PdfSaveOptions.OpenHyperlinksInNewWindow property to false to get the desired output. Note that if this option is set to true hyperlinks can’t work in some PDF readers e.g. Chrome, Firefox.

var opts = new PdfSaveOptions { OpenHyperlinksInNewWindow = false, TextCompression = PdfTextCompression.Flate };
doc.Save("output.pdf", opts);