Kiwi Kiwi - 1 year ago 70
Android Question

Deep linking href in pdf

I have a deep link that works when in the chrome browser to open my app with a certain ID. This link looks like following:


this works when in a webbrowser via
<a href="intent://...;end">click</a>

But when setting this link in a PDF (via aspose) this doesn't do anything, although it recognizes that it is a link (I can see the click animation).

The link is set via the following code::

var img = new Aspose.Pdf.Generator.Image(sec1);

//Assign a new instance of hyperlink to hyperlink property of segment
img.Hyperlink = new Hyperlink {
LinkType = HyperlinkType.File,
Url = "intent://m/#Intent;scheme=myapp://" + input.Reference + ";;end"

Answer Source

Non-standard URL schemes (which is what intent:// is, literally) aren't always treated as links. It sounds like the PDF viewer you're using isn't set up to recognize them correctly, and even if it were, the link would be broken anywhere except on Android devices.

Your best option is to somehow wrap that URL inside a link that the PDF viewer CAN recognize (http:// or https://), and then take care of opening your app later, usually by way of some sort of automatic redirect. This is how we handle things at, to make sure the app always launches no matter where the link is opened.