Created Hyperlink within PDF content not working in IOS Apple devices

Hi Aspose Support Team,

We have observed that the hyperlinks created within a PDF document are not clickable in case of Apple devices using IOS. Request your help to look into this as a top priority and help with resolving the same.

Note: But it does works fine in all other devices/OS including the desktops

Thanks & Regards

Mahesh Nanjappan

Sample Code used

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using Aspose.Pdf;
using Aspose.Pdf.Annotations;
using Aspose.Pdf.Text;
using Aspose.Pdf.Devices;
using System.IO;
using System.Diagnostics;
using System.Net.Mail;

namespace TestHyperlink
{
class Program
{
static void Main(string[] args)
{
string pattern = @“(?im)\bCONDITIONS\b”;
string inPutFile = @“C:\TEMP\From Old Computer\C Drive\Applications\Eaglepro\temp\temp1113\TESTPDFDocument.pdf”;
string outPutFile = @“C:\TEMP\From Old Computer\C Drive\Applications\Eaglepro\temp\temp1113\Output\Output.pdf”;
MemoryStream output;

        Aspose.Pdf.License obj = new Aspose.Pdf.License();
		obj.SetLicense("Aspose.Pdf.lic");
        
        if (File.Exists(outPutFile))
			File.Delete(outPutFile);

		using (FileStream fs = new FileStream(outPutFile, FileMode.CreateNew, FileAccess.Write))
		{
			byte[] bytes;
            output = CreateHyperlinks(inPutFile, pattern);
			bytes = new byte[output.Length];
			output.Read(bytes, 0, (int)output.Length);
			fs.Write(bytes, 0, bytes.Length);
			output.Close();
		}

        using (MailMessage mailMessage = new MailMessage())
        {
            System.Net.Mail.Attachment oAttachment = new Attachment(outPutFile);
            mailMessage.To.Add("mnanjappan@firstam.com");
            mailMessage.From = new MailAddress("mnanjappan@firstam.com");
            mailMessage.Subject = "Test Hyperlink in IOS";
            mailMessage.Attachments.Add(oAttachment);

            using (SmtpClient smtp = new SmtpClient("mail.firstam.com"))
            {
                smtp.Send(mailMessage);
            }
        }

        //OpenFile(outPutFile);
    }

    
    private static MemoryStream CreateHyperlinks(string sInputFilePath, string sPattern)
    {
        TextFragmentCollection textFragmentCollection;
        Stream input = System.IO.File.OpenRead(sInputFilePath);
        Document doc = new Document(input);
        TextFragmentAbsorber textFragmentAbsorber;
        MemoryStream output = new MemoryStream();
      
        foreach (Page p in doc.Pages)
        {
            textFragmentAbsorber = new TextFragmentAbsorber(sPattern, new TextSearchOptions(true));

            p.Accept(textFragmentAbsorber);

            textFragmentCollection = textFragmentAbsorber.TextFragments;

            foreach (TextFragment textFragment in textFragmentCollection)
            {
                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;

                    line.Name = Guid.NewGuid().ToString();
                    link.Name = Guid.NewGuid().ToString();

                    link.Contents = s.Text;
                    line.Border = new Border(link) { Width = 1 };
                    link.Border = new Border(link) { Width = 0 };
                    link.Action = new GoToURIAction("https://www.google.com");
                    p.Annotations.Add(link);
                    p.Annotations.Add(line);
                }
            }
        }

        doc.Save(output);

        return output;
    }
}

}

@mnanjappan.firstam

Thank you for contacting support.

We are unable to reproduce the issue with Aspose.PDF for .NET 19.5 on iOS 12.2. Please ensure using latest version of the API and share generated PDF document with us if you still face any problem.

Hi Farhan,

I work with Mahesh and he and I composed that post together. The one thing that we forgot to mention in the original post is that we are using version 17.10 of Aspose.PDF, we are not using version 19.5. So it appears that by upgrading to version 19.5, it will fix our issue.

Do you know if this was a known issue with 17.10 or would you expect it work to work with 17.10? The reason I ask is because upgrading the Aspose,PDF version will require us to complete a full regression test of our application which will take time. We were hoping that there might be a more immediate fix that we could do.

Thank you.

@grknutson

Please note that support is provided based on latest available version so we recommend latest version as they contain more features and bug fixes. However, we have tried with Aspose.PDF for .NET 17.10 but the issue is not reproduced with this version either. We have attached generated file for your kind reference. Output_17.10.pdf

Would you please try latest version and create a sample application containing SSCCE code and respective PDF documents if the issue persists in your environment.

Did tried by sending the Output_17.10.pdf provided by you through email and opened it using my iPhone 8+ version IOS 12.2 and clicked the “TEST” link and we are facing the same issue that we are currently encountering i.e. it doesn’t open the separate tab/browser for “www.google.com”

@mnanjappan.firstam

Can you please test the same over some other device with iOS 12.2 because we are unable to notice this issue with same email approach. Please also share your PDF document for our reference.

Farhan.Raza

As per your suggestion did tested over using other device with iOS 12.2 and having experienced similar issues.

Following steps were performed from our end and we would like you to please check in the same manner to make sure we are in the same page.

  1. Generate the Output.pdf with our POC using latest Aspose.PDF version 19.5 and sent as email.
  2. Accessed the email in iPhone having iOS 12.2 and opened the attached Output.pdf document (refer to attached AfterLinkClicked.png (76.4 KB)
    .png file).
  3. Clicked on the link “Conditions” and expected it to open a new browser with “www.google.com”; but instead it stayed within the document itself (refer to attached AfterLinkClicked.png" file).

It would be very helpful, if we can be able to setup a quick call to go over this critical problem in order to resolve this issue ASAP.

Thanks in advance and really appreciate your prompt responses.
Output.pdf (43.5 KB)
OpenPDFDoc.PNG (97.2 KB)
AfterLinkClicked.png (76.4 KB)

@mnanjappan.firstam

Thank you for elaborating it further.

We have been able to notice the problem when received email is opened in Outlook application, but it still works fine if the email and PDF is opened in Gmail application. However, a ticket with ID PDFNET-46386 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Farhan,

I was hoping you can clarify what you mean when you say that “We have been able to notice the problem when received email is opened in Outlook application, but it still works fine if the email and PDF is opened in Gmail application”. How do you open an email on an iPhone using Outlook or the gmail application?

For us, all our testing is done on an iPhone is done using the default mail client that comes with the iPhone. To be more clear, below are the steps with screenshots that we are doing to re-produce the error. In the steps below, I am opening an email in my gmail account that has a PDF attachment and in that PDF attachment we have a hyperlink. The code found at the top of this thread was the code used to generate the PDF. Even though this email is been read from Gmail account, the hyperlink still doesn’t work.

1 - Open Mail App on iPhone
1 - Open Mail App on iPhone.png (314.1 KB)

2 - Select gmail account from Email account list
2 - Select gmal account from account list.png (47.1 KB)

3 - Select email that has PDF attachment
3 - Select email that has PDF attachement.png (81.5 KB)

4 - Tap on attach PDF in Gmail Email
4 - Tap on attach PDF in Gmail Email.png (51.3 KB)

5 - Clicking on Conditions Hyperlink in PDF opened from IOS Default mail client does open a new window google.com
5 - Clicking on Conditions Hyperlink in PDF opened from IOS Default mail client does nothing.png (37.2 KB)

@grknutson

We were referring to Gmail and Microsoft Outlook application from the App Store. However, we are on the same page now, thank you for detailed explanation. We will let you know as soon as any further update will be available in this regard.

Hi Farhan,

Thanks for clarifying your testing procedure as well.

One last question, regarding ticket PDFNET-46386, that was added to your issue management system for investigation and resolution, how is priority assigned to those tickets? Are you able to say whether it would be resolved in the next month, the next 6 months, the next 12 months?

The reason I ask is because our business users will be asking me we can this issue be fixed and I just was looking for an answer that I can give to them.

Thanks.

@grknutson

We are afraid any ETA may not be available prior investigations into this issue. Moreover, it has been logged under free support model and will be investigated on first come first serve basis. Therefore, it may take some months to resolve. As soon as we have some definite updates regarding ticket resolution, we will let you know.

Furthermore, we also offer Paid Support, where issues are used to be investigated with higher priority. In case your reported issue is a blocker, you may please consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.

@Farhan.Raza

Since it’s already 10 months passed we didn’t get any reply back from your side. We tried with the latest Aspose.PDF version(V20.1) but still facing the same issue. Can you please look into the issue and try to give a stable solution ASAP.

@rajibfai

Thanks for contacting support.

We regret to share that earlier logged ticket is not yet resolved due to other high priority issues in the queue. We will surely inform you as soon as we have some certain news regarding its resolution. We greatly appreciate your patience and comprehension in this matter. Please spare us some time.

We are sorry for the inconvenience.

@asad.ali

Thanks for the reply.
Can you please provide an Estimated time to resolve the issue, so that we can update the same to our business.

@rajibfai

We are afraid that we cannot provide any ETA at the moment due to other implementations in queue. However, we have recorded your concerns and will surely consider them during issue investigation. Please spare us some time.

We are sorry for the inconvenience.

@asad.ali
We are still waiting for the response from your side. Is there any update regarding the issue whether its fixed or not?

@rajibfai

We regret to share that issue is not yet fixed. We will inform you as soon as we have additional updates about its resolution. Please give us some time.

@asad.ali
Since we are facing the same issue from a long time and its impacting our business. So did your technical team able to find out any solution?

@rajibfai

We really apologize for the delay in the resolution of the ticket. We have been busy implementing enhancement and new features which were requested and logged prior to this ticket. We will surely schedule an investigation and fix against this ticket and let you know once certain progress is made towards its resolution. Meanwhile, can you please try using 21.5 version of the API and let us know if issue is still there for Apple Devices?