Aspose Hyperlinks are not working

Aspose Hyperlinks are not working Windows 2012 server created PDF files

We are using Aspose.pdf.dll (Version: 8.8.0.0) for creating hyperlinks in PDF files. its was working fine with Windows 2003 server created PDF files, But recently our servers are migrated to Windows 2012. now in Windows 2012 server created PDF files hyperlink are not creating by Aspose.pdf.dll.


Please help for this issue ASAP. its very High priority PRODUCTION issue in our side.

NOTE: Refer the attached report.pdf for Window 2012 server created PDF and in that we are trying to create hyperlink in 2015 text and changing text to blue color. But hyperlink is not created and text only changing in blue color.

Regards,
Ganesan. B

Hi Ganesan,


Thanks for your inquiry. I am afraid you are using a quite old version. We have made a lot of fixes and improvements in the newer versions. Please download and try latest version of Aspose.Pdf for .NET i.e. 10.4.0, it will resolve the issue. If issue persist then please share your Please share your sample code here, so we will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Team,


I have tried with Aspose.pdf.dll version 10.4.0.0 and its also not working as expected.

Please refer the below my source code:

using Aspose.Pdf;
using Aspose.Pdf.InteractiveFeatures;
using Aspose.Pdf.InteractiveFeatures.Annotations;
using Aspose.Pdf.Text;
using Aspose.Pdf.Text.TextOptions;
using System.IO;
using System.Diagnostics;

string spattern = @“(?im)\b2015\b”;
string inPutFile = @“D:\Projects\EaglePro_CMMI\PoC\TestHyperlink\TestHyperlink\Files\Input\705967-bad.pdf”;
string outPutFile = @“D:\Projects\EaglePro_CMMI\PoC\TestHyperlink\TestHyperlink\Files\Output\Output.pdf”;

TextFragmentCollection textFragmentCollection;
Stream input = System.IO.File.OpenRead(inPutFile);
Document doc = new Document(input);
TextFragmentAbsorber textFragmentAbsorber;
//IList annotations;
MemoryStream output = new MemoryStream();
// Create links for each dictionary entry.
foreach (Page p in doc.Pages)
{
//create TextAbsorber object to find all instances of the input search phrase
textFragmentAbsorber = new TextFragmentAbsorber(spattern, new TextSearchOptions(true));

//accept the absorber for all the pages
p.Accept(textFragmentAbsorber);

//Get the extracted text fragments
textFragmentCollection = textFragmentAbsorber.TextFragments;

//Loop through the fragments and create links.
foreach (TextFragment textFragment in textFragmentCollection)
{
// If the found text fragment contains newline character, reduce the box to the end of the of the line.
foreach (TextSegment s in textFragment.Segments)
{
LinkAnnotation link = new LinkAnnotation(p, s.Rectangle);
Aspose.Pdf.Point start = new Aspose.Pdf.Point(s.Rectangle.LLX, s.Rectangle.LLY);
Aspose.Pdf.Point end = new Aspose.Pdf.Point(s.Rectangle.LLX + s.Rectangle.Width, s.Rectangle.LLY);
LineAnnotation line = new LineAnnotation(p, s.Rectangle, start, end);

s.TextState.ForegroundColor = Aspose.Pdf.Color.Blue;
line.Color = Aspose.Pdf.Color.Blue;
s.TextState.Underline = true;
link.Contents = s.Text;
line.Border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(link) { Width = 1 };
link.Border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(link) { Width = 0 };
link.Action = new GoToURIAction(“https://www.google.com”);
p.Annotations.Add(link);
p.Annotations.Add(line);
}
}
}

// Save the document to memory stream.
doc.Save(output);

byte[] bytes;

bytes = new byte[output.Length];
output.Read(bytes, 0, (int)output.Length);
fs.Write(bytes, 0, bytes.Length);
output.Close();

ProcessStartInfo psi = new ProcessStartInfo(outPutFile);
psi.UseShellExecute = true;
Process.Start(psi);

Regards,
Ganesan. B

Hi Ganesan,


Thanks for sharing sample code. We are trying to replicate the issue at our end and will let your know our findings soon.

We are sorry for the inconvenience caused.

Best Regards,

Hi Ganesan,


Thanks for your patience. It seems your colleague has posted same query in the PDF forum as well. After our initial investigation we have found that the issue is specific to your PDF document as I have tested scenario with Aspose.Pdf for .NET 8.8.0 and even it is not working with it. So we have logged a ticket PDFNEWNET-38745 in our issue tracking system for further investigation. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,